throw exception and bug fix