fix issue #3: crash with a large-variance samples

Fix issue #3.