fix bugs and add transform data function for revise data structure