Changed is.real and as.real to is.double and as.double, respectively