fixed callback handling in each()