Lots of type trait fixes.