Fix capacity check bug affecting offheap buffers