fix #658
Merge pull request #817 from Ciki/patch-1

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