change the checkWall method