Control loop not working