fix compile error on windows
fix offset bug