clean up before distribution