diff --git a/pixel.cpp b/pixel.cpp
index 0998f7c7929ad1964d5d1713814950e5f4107add..f252f49250840e4b63097173144265775f93eb70 100644
--- a/pixel.cpp
+++ b/pixel.cpp
@@ -38,7 +38,10 @@ void pixel(
 	#pragma HLS INTERFACE axis port=dout
 
 	pkt_t pkt=din.read();
-    pkt.data=stegno(character,pkt.data,position1,position2);
+    if (count_streams == 0){
+        charIn=toAscii((char)character);
+    }
+    pkt.data=stegno(charIn,pkt.data,position1,position2);
 	// switch(selector)
     // {
     //     case 0:
@@ -71,7 +74,7 @@ void pixel(
 
 int stegno(int c,int data,int position1,int position2){
 
-	charIn=toAscii((char)c);
+	
 	if((count_streams >= 3 * (position1 - 1)) && (count_streams < 3 * (position2))){
 		addNum=charIn%10;
 		charIn=(int)charIn/10;