Hmm, I can not confirm this problem so far. Does this only happen in a particular level? Maybe you're calling that function at a wrong time when not all entities are created yet?