Ok, I have found what was the issue. I was calling Game.getObjectById(...) before "loop" was started. The first time the method is called it seems to work, but later it seems to return old instance of the object (or some other garbage).   Maybe the method should fail when being called before "loop"?