Fix test, not declare variable in loop