How do I turn the AI off in RAIN during Runtime?

I am trying to have a system where the Player can switch in between characters and those he doesn’t control are controlled by Rain AI. I used this code:

using UnityEngine;
using RAIN.Core;
using RAIN.Entities;
using RAIN;
using System.Collections;

public class characterswap : MonoBehaviour {
Animator playeranim;
RuntimeAnimatorController playercon;
GameObject other;
Animator otheranim;
RuntimeAnimatorController othercon;

// Use this for initialization
void Start () {
	Variables.player = GameObject.FindGameObjectWithTag ("Player");
	Variables.player.GetComponentInChildren<AIRig> (true).AI.IsActive = false;
	playeranim = Variables.player.GetComponent<Animator> ();
	playercon = playeranim.runtimeAnimatorController;

	other = GameObject.FindGameObjectWithTag("Playable");
	otheranim = other.GetComponent<Animator> ();
	othercon = otheranim.runtimeAnimatorController;


// Update is called once per frame
void Update () {
	if (Input.GetKeyUp ("q")){
		playeranim.SetBool ("ai", true);
		AIRig playerai = Variables.player.GetComponentInChildren<AIRig> (true);

		playerai.AI.IsActive = true;

		Variables.player.tag = "Playable";

		otheranim.SetBool ("ai", false);
	        AIRig otherai = other.GetComponentInChildren<AIRig> (true);
		otherai.AI.IsActive = false;
		other.tag = "Player";

		Variables.player = GameObject.FindGameObjectWithTag ("Player"); 
		other = GameObject.FindGameObjectWithTag("Playable");

Unfortunately, it always gives back a NullReferenceException when loading the AiRig. Does anybody know how I could fix this?

rainObject.GetComponent().enabled = false;