You're going to pass -b backup -f cfpath [-s backup/path] -x args... regardless of whether cfengine_path has its default value or was set via ConfigurationSetCFEnginePath(), which is what incremented total_number_of_args.  So your total number of args isn't going to be enough if cfengine_path has its default value (or your +3 kludges that and leaves spare when cfengine_path was passed via the command-line; I'm a bit unclear here).  I don't think total_number_of_arguments is doing you any good; what you need here is ConfigurationNumberOfArguments()+(backup_path ? 2 : 0)+6ish, determined by the code below.  Counting how much of that came from the cf-upgrade command-line is just a distraction.