Fiixed tests and fixed foreeach