Changes to exception class and a bugfix.