fixed some buglets in generator