fix bug when write strings as attribute