Fixed the bugs in CheckLeft and CheckRight