util: add build_dict and build_list