[SHELL] Corrected the bug in generate function