Fix a bug in get_patch_around_cell and add a test.