Add error check to sortout.py, update for tesseract rev. 825