Bug fix, added exceptions.