exiting from popup, add actions to template