Added fix for creating dialogs with no parent.