Bug3518

R sessions changes are also included here (same as in the RSessions branch)