cleanup before publish