Fixes dialog closing too fast