Fixed some collision detection bugs