fixed issue with tie-breaking choice in gradient control law