Updated prepareArgs to use name instead of errmsg