fixing bug in buildGi