Replaced fs.xistsSync by fs.openSync