Fix null character serialization