cleaning up before submission