Fix generate command and tests.