BUGFIX: improved the error handling for types and attributes.