improve resolveTarget