minor error handling corrections