fixed some numerical underflow issues for sampleg