Correct some bug in the colision detection