Issue #7: Tweak for getting rid of numerical issue which may cause nan bugs.