corrected UD search routine