Fix serialization of int/str subclasses, e.g. bool

Without this fix, bools would be deserialized as ints, e.g.
getting a key that was set as True would return 1.
Merge pull request #4 from mquander/master

Fix a bug causing bools (and other subclasses) to get incorrectly serialized