Bug- and performance- fixes in the filename matching.