implement some functions.