fixes scoping issue in mainctrl