use buildkv from smap to handle nested keys