use fs.exist* instead of deprecated path.exist*
fix warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.