Fix notification count algorithm