Fixed JS errors with UI Dialog