refine code, add bug #160 for big chunk size.