implement some api functions