[FIX] Corrected some bugs in generation