Clear buffer before appending. Still not fully correct though...