fixed some numerical underflow issues
Merge pull request #9 from rrruss/master

fixed some numerical underflow issues for sampleg