added checks to ensure graceful failure when OCRed data is in an invalid format