FIXED: Wrong variable name ($reference instead of $ref)