Fix crash in dialog