Ensure ontology state is updated even on exceptions [2]

related to #340
Merge branch 'staging' into develop