exception handling improvement