fixed some numerical underflow issues