Exception and bug fix