improved exception handling.