Fixed bug in buffer class in getNext