extract common data structure
fix bugs of data_cmp