This is a highly specific bug, but took me a long time to find!
if on the game side you use
story.variablesState["variable_name"] = some_value
and then also have
=== function some_function(variable_name) ===
with variable_name not actually a global variable at all, then when that function is called it will use the value "some_value", not the value passed in by the function call.
Presumably what should be done here is the global variable should be set via a method that validates that the global is indeed a global, rather than pushing into the dictionary directly?