fixing bugs where multiple entries are found in patient files