Merge pull request #138 from derekparker/fix-typo

readme: Fix typo
diff --git a/README.md b/README.md
index 71edd94..9fa1933 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
 * reading from JSON, TOML, and YAML config files
 * live watching and re-reading of config files (optional)
 * reading from environment variables
-* reading from remote config systems (Etcd or Consul), and watching changes
+* reading from remote config systems (etcd or Consul), and watching changes
 * reading from command line flags
 * reading from buffer
 * setting explicit values
@@ -243,7 +243,7 @@
 `import _ "github.com/spf13/viper/remote"`
 
 Viper will read a config string (as JSON, TOML, or YAML) retrieved from a path
-in a Key/Value store such as Etcd or Consul.  These values take precedence over
+in a Key/Value store such as etcd or Consul.  These values take precedence over
 default values, but are overridden by configuration values retrieved from disk,
 flags, or environment variables.
 
@@ -288,7 +288,7 @@
 err := viper.ReadRemoteConfig()
 ```
 
-### Watching Changes in Etcd - Unencrypted
+### Watching Changes in etcd - Unencrypted
 
 ```go
 // alternatively, you can create a new viper instance.
diff --git a/viper.go b/viper.go
index 20c12ec..680b331 100644
--- a/viper.go
+++ b/viper.go
@@ -63,7 +63,7 @@
 }
 
 // Denotes encountering an unsupported remote
-// provider. Currently only Etcd and Consul are
+// provider. Currently only etcd and Consul are
 // supported.
 type UnsupportedRemoteProviderError string
 
@@ -742,8 +742,21 @@
 // Check to see if the key has been set in any of the data locations
 func IsSet(key string) bool { return v.IsSet(key) }
 func (v *Viper) IsSet(key string) bool {
-	t := v.Get(key)
-	return t != nil
+	path := strings.Split(key, v.keyDelim)
+
+	lcaseKey := strings.ToLower(key)
+	val := v.find(lcaseKey)
+
+	if val == nil {
+		source := v.find(strings.ToLower(path[0]))
+		if source != nil {
+			if reflect.TypeOf(source).Kind() == reflect.Map {
+				val = v.searchMap(cast.ToStringMap(source), path[1:])
+			}
+		}
+	}
+
+	return val != nil
 }
 
 // Have Viper check ENV variables for all
@@ -962,19 +975,27 @@
 	m := map[string]struct{}{}
 
 	for key, _ := range v.defaults {
-		m[key] = struct{}{}
+		m[strings.ToLower(key)] = struct{}{}
+	}
+
+	for key, _ := range v.pflags {
+		m[strings.ToLower(key)] = struct{}{}
+	}
+
+	for key, _ := range v.env {
+		m[strings.ToLower(key)] = struct{}{}
 	}
 
 	for key, _ := range v.config {
-		m[key] = struct{}{}
+		m[strings.ToLower(key)] = struct{}{}
 	}
 
 	for key, _ := range v.kvstore {
-		m[key] = struct{}{}
+		m[strings.ToLower(key)] = struct{}{}
 	}
 
 	for key, _ := range v.override {
-		m[key] = struct{}{}
+		m[strings.ToLower(key)] = struct{}{}
 	}
 
 	a := []string{}
diff --git a/viper_test.go b/viper_test.go
index d9aae00..aa62235 100644
--- a/viper_test.go
+++ b/viper_test.go
@@ -611,6 +611,17 @@
 	assert.Equal(t, 35, v.Get("age"))
 }
 
+func TestIsSet(t *testing.T) {
+	v := New()
+	v.SetConfigType("yaml")
+	v.ReadConfig(bytes.NewBuffer(yamlExample))
+	assert.True(t, v.IsSet("clothing.jacket"))
+	assert.False(t, v.IsSet("clothing.jackets"))
+	assert.False(t, v.IsSet("helloworld"))
+	v.Set("helloworld", "fubar")
+	assert.True(t, v.IsSet("helloworld"))
+}
+
 func TestDirsSearch(t *testing.T) {
 
 	root, config, cleanup := initDirs(t)