move the clearbuf function in post cmd processor