restore correct order of the buffer