return g to caller, compatible with tuning funciton