More robust directory reading