Fixed a few bugs, especially in the GUI.