Fix for path bugs in CMake and pyscript
Add target support for script