diff --git a/index.js b/index.js
index f0d11cdc537593442013f52244ce50993b030959..049096bdeb52afca14211056c8ff6b53eda1cc97 100644
--- a/index.js
+++ b/index.js
@@ -41,7 +41,7 @@ module.exports = function() {
   let keys = objectDeepKeys(config)
   for (let index = 0; index < keys.length; index++) {
     const element = keys[index]
-    let env = process.env[element.toUpperCase().replace('.', '_')]
+    let env = process.env[element.toUpperCase().replace(/\./g, '_')]
     if (env) {
       env = (env == 'true') ? true : env
       env = (env == 'false') ? false : env
diff --git a/index.test.js b/index.test.js
index a0541ae0a0e32e1116924b01579fabacb691f953..0a9c4bb58d63ec63f7583500d6f84c1d37a51b67 100644
--- a/index.test.js
+++ b/index.test.js
@@ -13,6 +13,11 @@ let jsonLocals = {
   setting:"localvalue",
   another: {
     more:"stuff"
+  },
+  even: {
+    deeper: {
+      key: 'sodeep'
+    }
   }
 }
 
@@ -54,6 +59,7 @@ describe('config', function() {
     
     process.env['SETTING'] = 'overwritten-by-env'
     process.env['ANOTHER_MORE'] = 'overwritten-by-env2'
+    process.env['EVEN_DEEPER_KEY'] = 'overwritten-by-env3'
     
     let config = new Config()
 
@@ -62,6 +68,7 @@ describe('config', function() {
 
     expect(config.setting).toBe('overwritten-by-env')
     expect(config.another.more).toBe('overwritten-by-env2')
+    expect(config.even.deeper.key).toBe('overwritten-by-env3')
     expect(config.another.setting).toBe('avalue')
   })
 })