verify func structure and improve type error message