Fixed path problems in script and added test switch