Change some fs.exists to fs.open