Fix error in file-extension/index determination function.