Fixed a bug in the collision mechanic