diff --git a/innobase/com/com0shm.c b/innobase/com/com0shm.c
index 72ab23b9be8b02c2f4140c08da218477bb73c9ea..ed185ccdf47b77ea74ea13f935e69eba2c482ca8 100644
--- a/innobase/com/com0shm.c
+++ b/innobase/com/com0shm.c
@@ -103,7 +103,8 @@ struct com_shm_endpoint_struct{
 				the area currently may contain a datagram;
 				NOTE: automatic event */
 	os_event_t	empty; 	/* this is in the signaled state if the area
-				currently may be empty; NOTE: automatic event */
+				currently may be empty; NOTE: automatic
+				event */
 	ip_mutex_hdl_t*	ip_mutex; /* handle to the interprocess mutex
 				protecting the shared memory */
 	UT_LIST_NODE_T(com_shm_endpoint_t) list; /* If the endpoint struct
@@ -793,16 +794,18 @@ com_shm_create_or_open(
 
 	ut_strcpy(buf + len, (char*)"_IBSHM_EV_NE"),
 
-	event_ne = os_event_create_auto(buf);
+	event_ne = os_event_create(buf);
 
 	ut_ad(event_ne);
 
 	ut_strcpy(buf + len, (char*)"_IBSHM_EV_EM"),
 
-	event_em = os_event_create_auto(buf);
+	event_em = os_event_create(buf);
 
 	ut_ad(event_em);
 
+	ut_a(0); /* event_ne and event_em should be auto events! */
+
 	com_shm_endpoint_set_shm(ep, shm);
 	com_shm_endpoint_set_map(ep, map);
 
diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c
index 0fe61fe570d3e6ac07b644e64d05ee1dbad01f19..bf5fc57bf576c747ce86a233022a58b33448833d 100644
--- a/innobase/os/os0sync.c
+++ b/innobase/os/os0sync.c
@@ -88,6 +88,12 @@ os_sync_free(void)
 	mutex = UT_LIST_GET_FIRST(os_mutex_list);
 
 	while (mutex) {
+	      if (mutex == os_sync_mutex) {
+		      /* Set the flag to FALSE so that we do not try to
+		      reserve os_sync_mutex any more in remaining freeing
+		      operations in shutdown */
+		      os_sync_mutex_inited = FALSE;
+	      }
 
 	      os_mutex_free(mutex);
 
@@ -517,13 +523,17 @@ os_mutex_free(
 {
 	ut_a(mutex);
 
-	os_mutex_enter(os_sync_mutex);
+	if (os_sync_mutex_inited) {
+		os_mutex_enter(os_sync_mutex);
+	}
 
 	UT_LIST_REMOVE(os_mutex_list, os_mutex_list, mutex);
 	
 	os_mutex_count--;
 
-	os_mutex_exit(os_sync_mutex);
+	if (os_sync_mutex_inited) {
+		os_mutex_exit(os_sync_mutex);
+	}
 
 #ifdef __WIN__
 	ut_a(CloseHandle(mutex->handle));
@@ -614,9 +624,16 @@ os_fast_mutex_free(
 #else
 	ut_a(0 == pthread_mutex_destroy(fast_mutex));
 #endif
-	os_mutex_enter(os_sync_mutex);
+	if (os_sync_mutex_inited) {
+		/* When freeing the last mutexes, we have
+		already freed os_sync_mutex */
+
+		os_mutex_enter(os_sync_mutex);
+	}
 
 	os_fast_mutex_count--;
 
-	os_mutex_exit(os_sync_mutex);
+	if (os_sync_mutex_inited) {
+		os_mutex_exit(os_sync_mutex);
+	}
 }
diff --git a/sql/slave.cc b/sql/slave.cc
index b655b17c258c91ef7864dd4d1da35d10f53889f2..ec1041894bd3c746044698d39e425c9740593cb6 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2081,8 +2081,13 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
   else
   {
     sql_print_error("\
-Could not parse log event entry, check the master for binlog corruption\n\
-This may also be a network problem, or just a bug in the master or slave code.\
+Could not parse relay log event entry. The possible reasons are: the master's \
+binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
+binary log), the slave's relay log is corrupted (you can check this by running \
+'mysqlbinlog' on the relay log), a network problem, or a bug in the master's \
+or slave's MySQL code. If you want to check the master's binary log or slave's \
+relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' \
+on this slave.\
 ");
     return 1;
   }