fixed bug in control loop