Add some minor error handling