Fix not emptying buffer.