fixed bad reading and writing of the package.json file