Fixed Item Iterator

It initialised cnt incorrectly before going to first key and therefore can randomly skip correct data
Environment set/get flags uses bit flags too
Update to new cfg style