few fixes for exception handling