Several fixes on build_gui