fixed showDialog and resume functions