fix handle failure more gracefully