port various fixes from trunk

git-svn-id: http://svn.r-project.org/R/branches/R-3-0-branch@62592 00db46b3-68df-0310-9c12-caf00c1e9a41
port r62597 from trunk

git-svn-id: http://svn.r-project.org/R/branches/R-3-0-branch@62598 00db46b3-68df-0310-9c12-caf00c1e9a41