merged pull requests from upstream and changed path.existsSync to fs.existsSync