Improved the error reporting for invalid records