Fixing collision detection