formatting and fix bug in recv_data() get_diff()