fix chessboard mask: sort chess mask, then gen board mask