Fixes to a number of numerical edge cases
Merge pull request #61 from rbharath/numerical_hardening

Fixes to a number of numerical edge cases