add valid? method to iterator