fix function,add test