fixed escaping problems when writing string in array