if the variable can't be fully resolved return last resolved part

e.g. assume `{{session.data.user.name}}` if user is null we should return
null (not the empty string as it was now).