fix buffer not flush bug