fix wrong ref problem