fixed incorrect $ref usage