Fixed a few minor bugs in type checking.