Fixed bug in feedback loop