(1) Fix handling of metdata items.
(2) Add messages for illegal state exceptions in semantic validation.