fix some indexing bugs.  iteration as a whole still could use cleaning in the api it seems