Fixed recursive generation of commands