Various R fixes