Made file matching more robust.