Fixed foreach problem with List