improve data generator
(cherry picked from commit 2b8a657cf3d07aa14120fd11ceffb131c9e23918)