Fix function references outside class