fixed a bug in grid byte*byte overflow, changed to integer, added a test case