fixed some issue when initiating a dialog