fix issues when patient not registered and not finding the patient id