Changed sys exit to exception.