diff --git a/cmd/root.go b/cmd/root.go
index a5612bf92ad819fd2478f177466c3bd800d4b510..2d98ebbee742521b414ffadd90d28e896390fa33 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -483,13 +483,14 @@ var rootCmd = &cobra.Command{
 				if m.MessageType != catalog.XxMessage {
 					strToPrint = fmt.Sprintf("type is %s",
 						m.MessageType)
+				} else {
+					receiveCnt++
 				}
 
 				fmt.Printf("Message received: %s\n",
 					strToPrint)
 
 				// fmt.Printf("%s", m.Timestamp)
-				receiveCnt++
 				if receiveCnt == expectedCnt {
 					done = true
 					break