Fix a bug with dialogs