Fix overriding of offset while writing bytes