Fix function call and variable screw up