Fixed bug at 0 for old algorithm
Merge