diff --git a/src/sender.c b/src/sender.c
index 017f8256bb0f0d8f79fddd5676553e8c9ea4a621..3e55fe801f15e8b0c2c8e2c04a4d9164332cde44 100644
--- a/src/sender.c
+++ b/src/sender.c
@@ -140,7 +140,7 @@ int main(int argc, char **argv) {
             break;
         }
 
-        if (pfd->revents & POLLIN)
+        if ((pfd->revents & POLLIN) && (pfd->revents & POLLOUT))
         {
             DEBUG("The sender is reading from the socket");
             rvalue = handle_returning_ack_nack(state, socket_fd);
diff --git a/src/sender_utils.c b/src/sender_utils.c
index 27aed81460f8ad466bae7434d40fdf85d27e4cae..d9e00349c502599afd8ccd1eedab47346441a407 100644
--- a/src/sender_utils.c
+++ b/src/sender_utils.c
@@ -114,15 +114,17 @@ int handle_returning_ack_nack(sender_state_t *state, int socket_fd)
     // Handling NACK:
     if (pkt_type == PTYPE_NACK) 
     {
-        if (state->map_seqnum_to_buffer_place[seqnum] == OUT_OFF_WINDOW)
+        uint8_t place = state->map_seqnum_to_buffer_place[seqnum];
+        if (place == OUT_OFF_WINDOW)
         {
             DEBUG("The NACK with the seqnum: %d is out of the sended window so it has been discarded", seqnum);
         }
         else
         {
-            DEBUG("The NACK with the seqnum: %d has been received", seqnum);
-            state->r_window_size = r_window;
-            if (send_pkt(state, pkt, seqnum, socket_fd) == -1) return -1;
+            DEBUG("The NACK with the seqnum: %d has been received, so the pkt will be sent back", seqnum);
+            state->r_window_size = r_window - 1; // -1 Because the receiver doesn't count yet the sended pkt
+            pkt_t *n_pkt = state->buffer[place];
+            if (send_pkt(state, n_pkt, place, socket_fd) == -1) return -1;
         }
     }
     // Handling ACK:
@@ -153,13 +155,14 @@ int handle_returning_ack_nack(sender_state_t *state, int socket_fd)
                 return 0;
             }
         }
-        // Some pkt need to be acked
+        // Some pkt need to be acknowledged
         else
         {
             state->r_window_size = r_window;
 
             uint8_t upper_bound = (place_last_ack + 1) % WINDOW_SIZE; // The oldest seqnum sended
-            DEBUG("The sender is cumulatively acknowledging [%d : %d[ (place in the buffer)", state->tail, upper_bound);
+            DEBUG("The sender is cumulatively acknowledging [%d : %d[ (place in the buffer) | [%d, %d[ (seqnum)", 
+                    state->tail, upper_bound, pkt_get_seqnum(state->buffer[state->tail]), seqnum_nack);
             // A do while is necessary here in case we want to make a full revolution (ack from 1 to 1 not included for example)
             do 
             {