Fix R2 compile warnings and update to R3