modify to reset dialog when open