Fix cleanupUnfold to handle Var case