Make (x, y) and (i, j) consistent