1> enclosed patient.matches and patient.equals in two separate try-catch-end loops, so that failing of one won't affect other.
2> Relaxed criteria for matching an item to SERIES. Just match SERIES_UID instead of matching a bunch of Tags. The assumption is that items belonging to different modalities would have different SERIES_UIDs.