adapt for iterator