Fix bug, where a return statement in a for loop stopped the loop.