handle error more gracefully