properly track prefix bytes written