fixing package.json template bug, adding error handling