Better handling of web exceptions.
added debug logging.