Fix the real culprit of the division-by-zero error