change deletehiddenbuffer function