Fix crash bug in GUI.