fix bug, and 5% improvement for large number