account for \0 when setting keys

fixes #5