fixing offset bugs