add some error handling.