rename validateToFile into validateFile