use offset instead of manually calculated header size