should have cleared up some memory bad access issue around range based for loop