fixed some bugs created when splitting into gui and controller