fixed nulled for loop