When setsparam() fails during add_autoparam(), the shell crashes. Patch attached. I'm not entirely sure -1 is the correct value to return on this error.