corrected for loops, still bad access