added checks for activity being null in all dialogs