exception handling bug fix