fix array looping