bugfix in iteration loops