Small improvement in exception handling