added the toPath method
restored old version of Script