fix incorrect serialisation of non-utf strings