replace self-defined exceptions with build-in exceptions