Bug fixes from previous commit to testSGP and updateSGP