Small type system improvements and fixes.