cleanup batch for key encode