enhance api
(cherry picked from commit 5eda94e)