corrected some mistakes in compute fg