add some more asserts for build_key_value