What am I doing wrong with hashtable.CopyTo?

I'm getting an error with the save routine for one of my javascript classes and I'm at a loss to see what's wrong with it.

  public var RawSettings = new Hashtable();

  // it gets loaded elsewhere with 3 key-value pairs,
  // verified by debug output showing a count of 3

  function Save(){
    Debug.Log("GamePrefs_Save initiated.
 Count is: " + RawSettings.Count );
    var PrefKeys: String[];
    if( FileName == "" ) {
      FileName = "Preferences";
      Debug.Log("GamePrefs.Save: No FileName specified, using Preferences.ini");
    }
    var srSaveFile : StreamWriter = new StreamWriter ( Application.persistentDataPath + "/" + FileName + ".ini" );
    RawSettings.Keys.CopyTo(PrefKeys,0);
    for(var x = 0; x < PrefKeys.length; x++){
      srSaveFile.WriteLine( PrefKeys[x] + "=" + RawSettings[PrefKeys[x]] as String );
    }
    srSaveFile.Close ();
    Debug.Log( "GamePrefs: Saved " + FileName + " as " + Application.persistentDataPath + "/" + FileName + ".ini" );
  }

Error message:

ArgumentNullException: Argument cannot be null. Parameter name: array System.Collections.Hashtable+HashKeys.CopyTo (System.Array array, Int32 arrayIndex)

You've only declared PrefKeys to be an array variable; you still need to instantiate an actual array object before making the call.

PrefKeys = new String[RawSettings.Keys.Count];
RawSettings.Keys.CopyTo(PrefKeys,0);