fixed test in a loop