fixed the code to work with the new "apidev" version of SGScript