updated SGScript, fixed Linux compatibility