fixed tests, added function def type checking