safe forEach