Fix bug in collision detection with invisible objects