fixing bug & fixing ui.cpp