fix reversed logic for reusing buffers