diff --git a/lib/config.js b/lib/config.js
index <HASH>..<HASH> 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -4,7 +4,8 @@
 
 var fs = require('fs'),
     path = require('path'),
-    Lock = require('lock');
+    Lock = require('lock'),
+    async = require('async');
 
 
 /**
@@ -55,7 +56,12 @@ exports.write = function (cfg, obj, callback) {
     catch (e) {
         return callback(e);
     }
-    return fs.writeFile(exports.path(cfg), data, callback);
+    var p = exports.path(cfg);
+    async.series([
+        async.apply(fs.writeFile, p + '.tmp', data),
+        async.apply(fs.rename, p + '.tmp', p)
+    ],
+    callback);
 };
 
 /**
write to tmp config file then move to final location to try and avoid reading mid-write