fix picking required version if it's available, clean up in tweak.py module

fix for #1062 reported by @ sylmarien
should be `filter(os.isfile, glob.glob(pattern))`?