This prevents dialog from closing automatically.