cleaned up CheckFuncAndDefine; tests are now passing