Fix divided by 0 error when tot = 0