Fixed #10 NPE in generator