rename variables to reflect types in Gamma; fix some bugs in type checking, but bugs still remain