Better handling of invalid records