Fixed writing of data.