account for \0 when setting keys

fixes #5
don't unnecessarily add NULL to keys or values
Merge pull request #8 from sphia/fix/gh-5

account for \0 when setting keys