improve some functions