Also, the actual .sgs file would be useful too...

Oh..did you run the script all the way through when you posted output.txt?