Fixed some bugs in the gui