Fixed problem of dialog showing up twice