fixed bug where s > p

git-svn-id: svn://svn.r-forge.r-project.org/svnroot/hdi@39 edb9625f-4e0d-4859-8d74-9fd3b1da38cb