Fix shell environment variable replacing; Copy variable values before assigning; Assign values properly to the arguments array
Fix leak with var_name creation while substituting arguments; Fix leak when replacing argument in the argument array without freeing it beforehand