Better handling of invalid data