fixed: read_chat_data has bugs in calc total_lengths.