Fixed schema gen to generate valid schemas