A temporary fix for faster module loading

*All* directories and *all* types were being checked, whereas always only the
first was being used.  This quick fix short-circuits search as soon as the
first candidate is found.