fix bug where offset could be mistakenly not zero