clean up before submission