minor error handling changes