KRACOEUS-8490: better exception handling, other minor cleanup