Sync with ucl, use new api to duplicate key and avoid memory leaks