fix WriteFile with subdir