#1640: Bug fixes to the file finder function.