added checks for actually initializing xplor and cns environments before output