Return dialog instance when no arguments are passed over.
Fixed refElement is undefined when closing dialog before dialog is opened.