Ensure ontology state is updated even on exceptions [2]

related to #340