Fixed the Buffer sorting