Fixed many type errors