Bugfix for collision detection