Add some error handling.