fixed bug of getoffset