fixed the errors with datalogging