Fix an annoying bug when writing variable

Due to this bug, it's possible to have wrong values in global variables 
so you have to start again the game and remove your savegames... :(