Fix a bug with negative offsets in fill_image_offset()