opening dialog on main thread