Fxed bug in to string and changed file write to locl