Fixing bug with opening dialogs