add some more asserts for build_key_value

fix tests & issue
Merge pull request #48 from vyorkin/build_key_value

add some more asserts for build_key_value