This commit fixes notification counter and duplicate generation of notifications.