moved field write code into a method
fixed debug info in case of new strings