Added exception for invalid schema. Relates to #1.