debug pregenerate function