Resolve some type errors