Fix error in generate

Fix #2