clean up before sending patch