fixed bug in 2d iterator, seems to work, but not thoroughly tested