Fixed bug in scgpm.js