Handle invalid data more gracefully.