Fix bugs with the dialogs showing at weird times