Write offsets to datasets only if message is processed

fixed.