Fixed off by one bug when discarding from a buffer.