remove code duplication in iterator_range
small fixes