Fix reference issue to function