cleanup before branching