Fix directory iteration on Windows XP