some minor error handling