Fix buffer I/O sometimes consuming extra bytes