fix edge case in buffer fixup logic