Add missing function types to error messages
Clean up type representations in error messages
Make type X and type of type object X distinct in messages
Fixes to test cases