Fixes a bug where keys contained dots which isn't allowed in mongo