DialogBox almost functioning correctly