fix edge case in buffer fixup logic
Merge branch 'master' into kif-pos