bugfix: convert ints to strings before write

Ensures all scalar values (like ints) are converted to string types before write.