fixed logic if the index file doesn’t exist