fixed eachUntil implementation