some changes to correct the reading of files from the directories