add support for structs with tags using reflect
merging with upstream