improved dialog window behavior