Corrects the bug of empty case in generation.