Fixed iterator and increased code coverage of test