diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result
index b736dbc..231afee 100644
--- a/mysql-test/suite/rpl/r/rpl_checksum.result
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result
@@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */;
 set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
 start slave;
 include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 367, the last event read from 'master-bin.000010' at 367, the last byte read from 'master-bin.000010' at 411.''
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 367, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 248.''
 select count(*) as zero from t1;
 zero
 0
diff --git a/sql/log.cc b/sql/log.cc
index d10c1ad..edb4c07 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -3531,20 +3531,16 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
 
     my_off_t offset= my_b_tell(&log_file);
 
-    /**
-     * TODO(jonaso): Check with Kristian, should last_commit_pos really
-     * be updated for relay logs!!!
-     */
     if (!is_relay_log)
     {
       /* update binlog_end_pos so that it can be read by after sync hook */
       reset_binlog_end_pos(log_file_name, offset);
-    }
 
-    mysql_mutex_lock(&LOCK_commit_ordered);
-    strmake_buf(last_commit_pos_file, log_file_name);
-    last_commit_pos_offset= offset;
-    mysql_mutex_unlock(&LOCK_commit_ordered);
+      mysql_mutex_lock(&LOCK_commit_ordered);
+      strmake_buf(last_commit_pos_file, log_file_name);
+      last_commit_pos_offset= offset;
+      mysql_mutex_unlock(&LOCK_commit_ordered);
+    }
 
     if (write_file_name_to_index_file)
     {
@@ -4816,8 +4812,18 @@ void MYSQL_BIN_LOG::make_log_name(char* buf, const char* log_ident)
 bool MYSQL_BIN_LOG::is_active(const char *log_file_name_arg)
 {
   /**
-   * there should/must be a mysql_mutex_assert_owner(&LOCK_log) here...
-   * but code violates this all over! (scary monsters and super creeps!)
+   * there should/must be mysql_mutex_assert_owner(&LOCK_log) here...
+   * but code violates this! (scary monsters and super creeps!)
+   *
+   * example stacktrace:
+   * #8  MYSQL_BIN_LOG::is_active
+   * #9  MYSQL_BIN_LOG::can_purge_log
+   * #10 MYSQL_BIN_LOG::purge_logs
+   * #11 MYSQL_BIN_LOG::purge_first_log
+   * #12 next_event
+   * #13 exec_relay_log_event
+   *
+   * I didn't investigate if this is ligit...(i.e if my comment is wrong)
    */
   return !strcmp(log_file_name, log_file_name_arg);
 }
@@ -6696,7 +6702,6 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd)
 
     offset= my_b_tell(&log_file);
 
-    /* update binlog_end_pos */
     update_binlog_end_pos(offset);
 
     /*
@@ -6745,7 +6750,6 @@ MYSQL_BIN_LOG::write_binlog_checkpoint_event_already_locked(const char *name,
 
   offset= my_b_tell(&log_file);
 
-  /* update binlog_end_pos */
   update_binlog_end_pos(offset);
 
   /*
@@ -7374,7 +7378,8 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
       {
         if (!current->error &&
             RUN_HOOK(binlog_storage, after_flush,
-                (current->thd, log_file_name,
+                (current->thd,
+                 current->cache_mngr->last_commit_pos_file,
                  current->cache_mngr->last_commit_pos_offset, synced)))
         {
           current->error= ER_ERROR_ON_WRITE;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 7482f52..8518747 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -2045,9 +2045,8 @@ static int init_binlog_sender(binlog_send_info *info,
   connect_gtid_state.length(0);
 
   /** save start file/pos that was requested by slave */
-  strncpy(info->start_log_file_name, log_ident,
+  strmake(info->start_log_file_name, log_ident,
           sizeof(info->start_log_file_name));
-  info->start_log_file_name[sizeof(info->start_log_file_name)-1]= 0;
   info->start_pos= *pos;
 
   /** init last pos */
@@ -2232,8 +2231,12 @@ static int send_format_descriptor_event(binlog_send_info *info,
       Try to find a Format_description_log_event at the beginning of
       the binlog
     */
-    if ((error= Log_event::read_log_event(log, packet, /* LOCK_log */ NULL,
-                                          info->current_checksum_alg)))
+    info->last_pos= my_b_tell(log);
+    error= Log_event::read_log_event(log, packet, /* LOCK_log */ NULL,
+                                     info->current_checksum_alg);
+    linfo->pos= my_b_tell(log);
+
+    if (error)
     {
       set_read_error(info, error);
       break;
@@ -2388,12 +2391,13 @@ static int wait_new_events(binlog_send_info *info,         /* in */
       {
         struct event_coordinates coord = { linfo->log_file_name, linfo->pos };
 #ifndef DBUG_OFF
-        if (info->hb_info_counter < 3)
+        const int hb_info_counter_limit = 3;
+        if (info->hb_info_counter < hb_info_counter_limit)
         {
           sql_print_information("master sends heartbeat message %s:%llu",
                                 linfo->log_file_name, linfo->pos);
           info->hb_info_counter++;
-          if (info->hb_info_counter == 3)
+          if (info->hb_info_counter == hb_info_counter_limit)
             sql_print_information("the rest of heartbeat info skipped ...");
         }
 #endif
@@ -2641,7 +2645,10 @@ static int send_one_binlog_file(binlog_send_info *info,
 
   /* seek to the requested position, to start the requested dump */
   if (start_pos != BIN_LOG_HEADER_SIZE)
+  {
     my_b_seek(log, start_pos);
+    linfo->pos= start_pos;
+  }
 
   while (!should_stop(info))
   {
