Correcting the output on some values, like 8x8. Check if the grid is larger than maximum height or width.