Fix some bugs during data generation and data analyse.