Fixed the multiple dialog windows bug