prevent JS error on reinitialising dialog
Merge pull request #225 from christianwach/check-dialog

Prevent JS error on reinitialising dialog.

Props @christianwach.