Bug fixes on OCR