changed pathWithPkgName to variable, added an error msg