Fix for #227 and rootpath in js

There is also a fix for the printing of the rootpath for js scripts.