fixed exception name
added local keywords where appropriate