Fix incorrect path returned by getScriptPath(). Closes #658