better type checking

* removed extra code from type checker and from the substitution syntax.
* debugged some of the type checking code