Fixed a host of type errors