Improvement for exception handling