Some changes in gameobjects.pas, masked_collision.pas and sprites.pas

Hopefully it is step forward fixing that ugly crash.