store keyCount to buffer
delete output