fixed offset bugs