fixed bug1, a critical problem with check_board_contiguity