Fixed a critical bug with not writing data.