fix wrong mixed up ipairs/pairs calls