Fixed bugs in light-control script