fix invalid argument on foreach..again