Correct collision with right and left walls.