Correcting initialization of sum and cnt during nonsubkey case