Fix generator template files location bug;
Add a test cast for generator.