Fix bug with block buffer overrun