Fixed find_file function.

It was incorrectly finding the prefered file.