corrected issue where ssos query looped forever.