raise exceptions when unexpected values are found