update pgl fitting code