Bugfix - update type when updating value.

In my app a value changes from `"sample1"` to `false`.

It changes the type from `string` to `boolean`. 

This caused an error: 

Before: An error is thrown, because `escapeString` cannot escape a boolean (i.e. booleans don't have a `replace` function)
After: No error is thrown.
Merge pull request #14 from markmarijnissen/patch-1

Bugfix - update type when updating value.