Correctly handle '--length' argument for generate