fixed the problem with only the last items being added to the buffer.