Fix #2291. Dir[] fails if path does not exist instead of returning nil