delete your buffers after exit from the while
initialize them before entry into the while loop