auto cleanup before save