fix checkboundaries top and bottom exits