Improved some type errors