safer for/in loop