Changed as.real to as.double (removed from R v.3)