add functions to show dialog allow state loss