fixed unsafe handling for iterator sections, added tests