use Val as type of udata instead of Val*, which is not necessary