Fixed variable name bug in list iteration