fixed write file probs