Fixing str errors and better exceptions.