Fixed problem of data not being logged completely