Fix type of result from write.