Fix writing of empty strings