Anti-windup feature corrected (untested).