fix bug: should assign based on whether the parameter is undefined

fix a bug in default parameter, should assign based on whether the parameter is undefined