Fixed the buffer bug