Fix some bugs found with GUI