Fixed some problems with too many type errors being generated at some points. There is still a problem with false type errors being generated.