Fix bug in directory read with json files