added check_typename function in tree.c