Boost/loop bugfix