Fix function call order