fixed an issue where the overlay would be displayed even when a dialog
had been hidden