 			// R only returns coefficients and rSquared
 			if (RresultArray.length == 2)
 			{
-				coefficients = ((RresultArray[0] as RResult).value as Array != coefficients) ? (RresultArray[0] as RResult).value as Array : null;
+				
+				//coefficients = ((RresultArray[0] as RResult).value as Array != coefficients) ? (RresultArray[0] as RResult).value as Array : null;
+				coefficients = (RresultArray[0] as RResult).value as Array;
+				
 				// Preprocess coefficients ==> It might return NaN in higher degree
 				// where it should in fact be 0.
+				
+				// problem arises sometimes, when coefficients is null, meaning the R calls are not done yet? May be create a busy loop?
 				for (var i:int = 0; i < coefficients.length; i++)
 				{
 					if (isNaN(coefficients[i]))

				
				return result;
			}
			else if (type == LOGARITHMIC) 
			{	
				return coefficients[0]*Math.log(xValue) + coefficients[1];
			}
				
				
			else if (type == EXPONENTIAL) 
			{
				return Math.exp(coefficients[0])*Math.exp(xValue*coefficients[1]);
			}
			else if (type == POWER) 
			{
				return Math.exp(coefficients[0])*Math.pow(xValue, coefficients[1]);	
			}
			else
			{

		 **/
		private function evalFunction(type:String, coefficients:Array, xValue:Number):Number
		{
				
			var b:Number = coefficients[0];
			var a:Number = coefficients[1];
			
			if (type == POLYNOMIAL) 
			{
