added VALID variable