test reference in hook function