fix bug in (generate) introduced by fail-handling.