Fixed NPE when generating structures.