calling fs.exists before checking fs.stats