Fix NPE when using the OCR