Fixed loop, should fix issue #234