fix offset bug