Solve bug in the colision detection