Fixed folding at the end of the buffer.