Handle buffers properly when expanding beyond original size