diff --git a/addressbook/backends/ldap/e-book-backend-ldap.c b/addressbook/backends/ldap/e-book-backend-ldap.c
index 1a90b97..069544a 100644
--- a/addressbook/backends/ldap/e-book-backend-ldap.c
+++ b/addressbook/backends/ldap/e-book-backend-ldap.c
@@ -99,7 +99,7 @@
 
 #endif
 
-#define d(x)
+#define d(x) G_STMT_START { if (enable_debug) { x ; } } G_STMT_END
 
 #ifndef G_OS_WIN32
 
@@ -720,17 +720,17 @@ get_ldap_library_info (void)
 	}
 	else {
 		gint i;
-		g_message ("libldap vendor/version: %s %2d.%02d.%02d",
+		d (g_message ("libldap vendor/version: %s %2d.%02d.%02d",
 			   info.ldapai_vendor_name,
 			   info.ldapai_vendor_version / 10000,
 			   (info.ldapai_vendor_version % 10000) / 1000,
-			   info.ldapai_vendor_version % 1000);
+			   info.ldapai_vendor_version % 1000));
 
-		g_message ("library extensions present:");
+		d (g_message ("library extensions present:"));
 		/* yuck.  we have to free these? */
 		for (i = 0; info.ldapai_extensions[i]; i++) {
 			gchar *extension = info.ldapai_extensions[i];
-			g_message ("%s", extension);
+			d (g_message ("%s", extension));
 			ldap_memfree (extension);
 		}
 		ldap_memfree (info.ldapai_extensions);
@@ -786,8 +786,9 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 	values = ldap_get_values (bl->priv->ldap, resp, "supportedControl");
 	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (values) {
-		for (i = 0; values[i]; i++)
-			g_message ("supported server control: %s", values[i]);
+		for (i = 0; values[i]; i++) {
+			d (g_message ("supported server control: %s", values[i]));
+		}
 		ldap_value_free (values);
 	}
 
@@ -796,9 +797,9 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 	if (values) {
 		for (i = 0; values[i]; i++) {
-			g_message ("supported server extension: %s", values[i]);
+			d (g_message ("supported server extension: %s", values[i]));
 			if (!strcmp (values[i], LDAP_EXOP_START_TLS)) {
-				g_message ("server reports LDAP_EXOP_START_TLS");
+				d (g_message ("server reports LDAP_EXOP_START_TLS"));
 			}
 		}
 		ldap_value_free (values);
@@ -824,7 +825,7 @@ query_ldap_root_dse (EBookBackendLDAP *bl)
 		for (i = 0; values[i]; i++) {
 			auth_method = g_strdup_printf ("sasl/%s|%s", values[i], values[i]);
 			bl->priv->supported_auth_methods = g_list_append (bl->priv->supported_auth_methods, auth_method);
-			g_message ("supported SASL mechanism: %s", values[i]);
+			d (g_message ("supported SASL mechanism: %s", values[i]));
 		}
 		ldap_value_free (values);
 	}
@@ -906,7 +907,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl)
 		if (bl->priv->use_tls != E_BOOK_BACKEND_LDAP_TLS_NO) {
 
 			if (!bl->priv->ldap_v3 && bl->priv->use_tls == E_BOOK_BACKEND_LDAP_TLS_ALWAYS) {
-				g_message ("TLS not available (fatal version), v3 protocol could not be established (ldap_error 0x%02x)", ldap_error);
+				d (g_message ("TLS not available (fatal version), v3 protocol could not be established (ldap_error 0x%02x)", ldap_error));
 				ldap_unbind (blpriv->ldap);
 				blpriv->ldap = NULL;
 				g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
@@ -931,7 +932,7 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl)
 #elif defined (G_OS_WIN32)
 				ldap_set_option (blpriv->ldap, LDAP_OPT_SSL, LDAP_OPT_ON);
 #else
-				g_message ("TLS option not available");
+				d (g_message ("TLS option not available"));
 #endif
 #endif
 			}
@@ -964,18 +965,18 @@ e_book_backend_ldap_connect (EBookBackendLDAP *bl)
 #endif
 				if (LDAP_SUCCESS != ldap_error) {
 					if (bl->priv->use_tls == E_BOOK_BACKEND_LDAP_TLS_ALWAYS) {
-						g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", ldap_error);
+						d (g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", ldap_error));
 						ldap_unbind (blpriv->ldap);
 						blpriv->ldap = NULL;
 						g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 						return GNOME_Evolution_Addressbook_TLSNotAvailable;
 					}
 					else {
-						g_message ("TLS not available (ldap_error 0x%02x)", ldap_error);
+						d (g_message ("TLS not available (ldap_error 0x%02x)", ldap_error));
 					}
+				} else {
+					d (g_message ("TLS active"));
 				}
-				else
-					g_message ("TLS active");
 			}
 		}
 
@@ -1658,7 +1659,7 @@ e_book_backend_ldap_create_contact (EBookBackend *backend,
 
 		book_view = find_book_view (bl);
 
-		printf ("Create Contact: vcard = %s\n", vcard);
+		d (printf ("Create Contact: vcard = %s\n", vcard));
 
 		create_op->new_contact = e_contact_new_from_vcard (vcard);
 
@@ -2303,7 +2304,7 @@ e_book_backend_ldap_modify_contact (EBookBackend *backend,
 
 		book_view = find_book_view (bl);
 
-		printf ("Modify Contact: vcard = %s\n", vcard);
+		d (printf ("Modify Contact: vcard = %s\n", vcard));
 		modify_op->contact = e_contact_new_from_vcard (vcard);
 		modify_op->id = e_contact_get_const (modify_op->contact, E_CONTACT_UID);
 
@@ -2558,7 +2559,7 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 	gulong diff;
 
 	if (enable_debug) {
-		printf ("contact_list_handler ...\n");
+		d (printf ("contact_list_handler ...\n"));
 		g_get_current_time (&start);
 	}
 
@@ -2567,8 +2568,7 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 		e_data_book_respond_get_contact_list (op->book, op->opid, GNOME_Evolution_Addressbook_OtherError, NULL);
 		ldap_op_finished (op);
-		if (enable_debug)
-			printf ("contact_list_handler ... ldap handler is NULL \n");
+		d (printf ("contact_list_handler ... ldap handler is NULL \n"));
 		return;
 	}
 	g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
@@ -2587,7 +2587,7 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 
 			vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
 
-			printf ("vcard = %s\n", vcard);
+			d (printf ("vcard = %s\n", vcard));
 
 			contact_list_op->contacts = g_list_append (contact_list_op->contacts,
 								   vcard);
@@ -2639,11 +2639,10 @@ contact_list_handler (LDAPOp *op, LDAPMessage *res)
 
 		ldap_op_finished (op);
 		if (enable_debug) {
-			printf ("contact_list_handler success ");
 			g_get_current_time (&end);
 			diff = end.tv_sec * 1000 + end.tv_usec/1000;
 			diff -= start.tv_sec * 1000 + start.tv_usec/1000;
-			printf("and took %ld.%03ld seconds\n", diff/1000, diff%1000);
+			d (printf("contact_list_handler success and took %ld.%03ld seconds\n", diff/1000, diff%1000));
 		}
 	}
 	else {
@@ -2680,7 +2679,7 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 	gulong diff;
 
 	if (enable_debug) {
-		printf ("e_book_backend_ldap_get_contact_list ... \n");
+		d (printf ("e_book_backend_ldap_get_contact_list ... \n"));
 		g_get_current_time (&start);
 	}
 
@@ -2716,7 +2715,7 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 			e_data_book_respond_get_contact_list (book, opid, GNOME_Evolution_Addressbook_OtherError, NULL);
 			if (enable_debug)
-				printf ("e_book_backend_ldap_get_contact_list... ldap handler is NULL\n");
+				d (printf ("e_book_backend_ldap_get_contact_list... ldap handler is NULL\n"));
 			return;
 		}
 		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
@@ -2726,10 +2725,11 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 
 		ldap_query = e_book_backend_ldap_build_query (bl, query);
 
-		printf ("getting contact list with filter: %s\n", ldap_query);
+		d (printf ("getting contact list with filter: %s\n", ldap_query));
 
 		do {
 			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+			printf (" ** %s: invoking LDAP search with '%s'\n", __FUNCTION__, ldap_query ? ldap_query : "[null]");
 			ldap_error = ldap_search_ext (bl->priv->ldap,
 						      bl->priv->ldap_rootdn,
 						      bl->priv->ldap_scope,
@@ -2752,8 +2752,8 @@ e_book_backend_ldap_get_contact_list (EBookBackend *backend,
 				diff = end.tv_sec * 1000 + end.tv_usec/1000;
 				diff -= start.tv_sec * 1000 + start.tv_usec/1000;
 
-				printf ("e_book_backend_ldap_get_contact_list invoked contact_list_handler ");
-				printf ("and took %ld.%03ld seconds\n", diff/1000, diff%1000);
+				d (printf ("e_book_backend_ldap_get_contact_list invoked contact_list_handler "
+					"and took %ld.%03ld seconds\n", diff/1000, diff%1000));
 			}
 		}
 		else {
@@ -4044,6 +4044,9 @@ e_book_backend_ldap_build_query (EBookBackendLDAP *bl, const gchar *query)
 	gint i;
 	gchar **strings;
 
+	if (!query || g_ascii_strcasecmp (query, "(contains \"x-evolution-any-field\" \"\")") == 0)
+		return NULL;
+
 	data.list = NULL;
 	data.bl = bl;
 
@@ -4069,7 +4072,7 @@ e_book_backend_ldap_build_query (EBookBackendLDAP *bl, const gchar *query)
 
 	if (data.list) {
 		if (data.list->next) {
-			g_warning ("conversion to ldap query string failed");
+			g_warning ("conversion to ldap query string failed '%s'", query ? query : "[null]");
 			retval = NULL;
 			g_list_foreach (data.list, (GFunc)g_free, NULL);
 		}
@@ -4092,7 +4095,7 @@ e_book_backend_ldap_build_query (EBookBackendLDAP *bl, const gchar *query)
 		}
 	}
 	else {
-		g_warning ("conversion to ldap query string failed");
+		g_warning ("conversion to ldap query string failed '%s'", query ? query : "[null]");
 		retval = NULL;
 	}
 
@@ -4149,13 +4152,13 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 
 		g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 
-		printf ("attr = %s \n", attr);
+		d (printf ("attr = %s ", attr));
 		if (ldap_uid && !g_ascii_strcasecmp (attr, "uid")) {
 			g_static_rec_mutex_lock (&eds_ldap_handler_lock);
 			values = ldap_get_values (bl->priv->ldap, e, attr);
 			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 			if (values) {
-				printf ("uid value = %s\n", values[0]);
+				d (printf ("uid value = %s ", values[0]));
 				if (values[0])
 					*ldap_uid = g_strdup (values[0]);
 				ldap_value_free (values);
@@ -4165,7 +4168,7 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 			values = ldap_get_values (bl->priv->ldap, e, attr);
 			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
 			for (i = 0; values[i]; i ++) {
-				printf ("value = %s\n", values[i]);
+				d (printf ("value = %s ", values[i]));
 				if (!g_ascii_strcasecmp (values[i], "groupOfNames")) {
 					e_contact_set (contact, E_CONTACT_IS_LIST, GINT_TO_POINTER (TRUE));
 					e_contact_set (contact, E_CONTACT_LIST_SHOW_ADDRESSES, GINT_TO_POINTER (TRUE));
@@ -4182,7 +4185,7 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 					break;
 				}
 
-			printf ("info = %p\n", (gpointer) info);
+			d (printf ("info = %p ", (gpointer) info));
 
 			if (info) {
 				if (info->prop_type & PROP_WRITE_ONLY) {
@@ -4210,7 +4213,7 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 
 					if (values) {
 						if (info->prop_type & PROP_TYPE_STRING) {
-							printf ("value = %s\n", values[0]);
+							d (printf ("value = %s ", values[0]));
 							/* if it's a normal property just set the string */
 							if (values[0])
 								e_contact_set (contact, info->field_id, values[0]);
@@ -4246,9 +4249,10 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 							for (j = 0; values[j] ; j++) {
 								/* get the email id for the given dn */
 								/* set base to DN and scope to base */
-								printf ("value (dn) = %s \n", values [j]);
+								d (printf ("value (dn) = %s ", values [j]));
 								do {
 									g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+									printf (" ** %s: invoking LDAP search with '%s'\n", __FUNCTION__, "[null]");
 									if ((ldap_error = ldap_search_ext_s (bl->priv->ldap,
 													values[j],
 													LDAP_SCOPE_BASE,
@@ -4264,14 +4268,14 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 										email_values = ldap_get_values (bl->priv->ldap, result, "mail");
 
 										if (email_values) {
-											printf ("email = %s \n", email_values[0]);
+											d (printf ("email = %s ", email_values[0]));
 											*(member_info + j) =
 												g_strdup_printf ("%s;%s;",
 														 email_values[0], values[j]);
 											ldap_value_free (email_values);
 										}
 										if (cn_values) {
-											printf ("cn = %s \n", cn_values[0]);
+											d (printf ("cn = %s ", cn_values[0]));
 											*(member_info + j) =
 												g_strconcat (*(member_info + j),
 													     cn_values [0], NULL);
@@ -4303,6 +4307,7 @@ build_contact_from_entry (EBookBackendLDAP *bl,
 			}
 		}
 
+		d (printf ("\n"));
 		ldap_memfree (attr);
 		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
 	}
@@ -4532,7 +4537,7 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 
 		/* search for nonempty full names */
 		if (!ldap_query && can_browse ((EBookBackend *)bl))
-			ldap_query = g_strdup ("(cn=*)");
+			ldap_query = g_strdup (g_getenv ("LDAP_OBJCLS") ? "(objectclass=*)" : "(cn=*)");
 
 		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
 		if (ldap_query != NULL && bl->priv->ldap) {
@@ -4546,13 +4551,13 @@ e_book_backend_ldap_search (EBookBackendLDAP *bl,
 			if (view_limit == -1 || view_limit > bl->priv->ldap_limit)
 				view_limit = bl->priv->ldap_limit;
 
-			printf ("searching server using filter: %s (expecting max %d results)\n", ldap_query,
-				view_limit);
+			d (printf ("searching server using filter: %s (expecting max %d results)\n", ldap_query, view_limit));
 
 			do {
 				book_view_notify_status (bl, view, _("Searching..."));
 
 				g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+				printf (" ** %s: invoking LDAP search with '%s'\n", __FUNCTION__, ldap_query ? ldap_query : "[null]");
 				ldap_err = ldap_search_ext (bl->priv->ldap, bl->priv->ldap_rootdn,
 							    bl->priv->ldap_scope,
 							    ldap_query,
@@ -4784,6 +4789,7 @@ generate_cache (EBookBackendLDAP *book_backend_ldap)
 
 	do {
 		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
+		printf (" ** %s: invoking LDAP search with '%s'\n", __FUNCTION__, ldap_query ? ldap_query : "[null]");
 		ldap_error = ldap_search_ext (priv->ldap,
 					      priv->ldap_rootdn,
 					      priv->ldap_scope,
@@ -4904,7 +4910,7 @@ e_book_backend_ldap_authenticate_user (EBookBackend *backend,
 		bl->priv->auth_passwd = g_strdup (passwd);
 
 		/* now authenticate against the DN we were either supplied or queried for */
-		printf ("simple auth as %s\n", dn);
+		d (printf ("simple auth as %s\n", dn));
 		g_static_rec_mutex_lock (&eds_ldap_handler_lock);
 		if (!bl->priv->connected || !bl->priv->ldap) {
 			g_static_rec_mutex_unlock (&eds_ldap_handler_lock);
diff --git a/calendar/libecal/e-cal-recur.c b/calendar/libecal/e-cal-recur.c
index 16f02bf..c8e23f4 100644
--- a/calendar/libecal/e-cal-recur.c
+++ b/calendar/libecal/e-cal-recur.c
@@ -697,8 +697,10 @@ e_cal_recur_generate_instances_of_rule (ECalComponent	 *comp,
 	e_cal_component_get_dtend (comp, &dtend);
 
 	if (!dtstart.value) {
+		gchar *comp_str = e_cal_component_get_as_string (comp);
 		g_message ("e_cal_recur_generate_instances_of_rule(): bogus "
-			   "component, does not have DTSTART.  Skipping...");
+			   "component, does not have DTSTART.\n%s\n Skipping...", comp_str ? comp_str : NULL);
+		g_free (comp_str);
 		goto out;
 	}
 
