debug some use of 'this' in database class, modify all fg operation into mainController