-Adjust how dialogs set return code

-Adjust how dialogs set return code