fixed bug in generator