fixed writetextfile error