diff --git a/config.c b/config.c
index c63b2fded626f6d1b274f8a2a2ab8e6f46750f19..b9f43a17ea8e2f8ea7aee0788bf3994b5bda5bbe 100755
--- a/config.c
+++ b/config.c
@@ -162,7 +162,7 @@ struct ast_config *ast_load(char *configfile)
 	int lineno=0;
 
 	if (configfile[0] == '/') {
-		strncpy(fn, configfile, sizeof(fn));
+		strncpy(fn, configfile, sizeof(fn)-1);
 	} else {
 		snprintf(fn, sizeof(fn), "%s/%s", AST_CONFIG_DIR, configfile);
 	}
@@ -221,7 +221,7 @@ struct ast_config *ast_load(char *configfile)
 								fclose(f);
 								return NULL;
 							}
-							strncpy(tmpc->name, cur+1, sizeof(tmpc->name));
+							strncpy(tmpc->name, cur+1, sizeof(tmpc->name)-1);
 							tmpc->root =  NULL;
 							tmpc->next = tmp->root;
 							tmp->root = tmpc;
@@ -261,7 +261,7 @@ struct ast_config *ast_load(char *configfile)
 								return NULL;
 							}
 						} else {
-							ast_log(LOG_WARNING, "No '=' (equal sign) in line %d\n", lineno);
+							ast_log(LOG_WARNING, "No '=' (equal sign) in line %d of %s\n", lineno, configfile);
 						}
 														
 					}
diff --git a/include/asterisk/parking.h b/include/asterisk/parking.h
new file mode 100755
index 0000000000000000000000000000000000000000..6b3dec1f10ab534d77e45aef153e8085352e805b
--- /dev/null
+++ b/include/asterisk/parking.h
@@ -0,0 +1,47 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Call Parking API 
+ * 
+ * Copyright (C) 1999, Mark Spencer
+ *
+ * Mark Spencer <markster@linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ *
+ * Includes code and algorithms from the Zapata library.
+ *
+ */
+
+#ifndef _PARKING_H
+#define _PARKING_H
+
+//! Park a call and read back parked location
+/*! \param chan the channel to actually be parked
+    \param host the channel which will have the parked location read to
+	Park the channel chan, and read back the parked location to the
+	host.  If the call is not picked up within a specified period of
+	time, then the call will return to the last step that it was in 
+	(in terms of exten, priority and context)
+*/
+extern int ast_park_call(struct ast_channel *chan, struct ast_channel *host);
+//! Park a call via a masqueraded channel
+/*! \param rchan the real channel to be parked
+    \param host the channel to have the parking read to
+	Masquerade the channel rchan into a new, empty channel which is then
+	parked with ast_park_call
+*/
+extern int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *host);
+
+//! Determine system parking extension
+/*! Returns the call parking extension for drivers that provide special
+    call parking help */
+extern char *ast_parking_ext(void);
+
+//! Bridge a call, optionally allowing redirection
+
+extern int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, int allowredirect);
+
+
+#endif /* _PARKING_H */
diff --git a/loader.c b/loader.c
index 8293993f36544a32e8963dba68d49421bdfd0e7a..1326561987154315750ff514cdea0377f5a06686 100755
--- a/loader.c
+++ b/loader.c
@@ -161,14 +161,19 @@ int ast_load_resource(char *resource_name)
 	struct ast_config *cfg;
 	/* Keep the module file parsing silent */
 	o = option_verbose;
-	option_verbose = 0;
-	cfg = ast_load(AST_MODULE_CONFIG);
-	option_verbose = o;
-	if (cfg) {
-		if ((val = ast_variable_retrieve(cfg, "global", resource_name))
-				&& ast_true(val))
-			flags |= RTLD_GLOBAL;
-		ast_destroy(cfg);
+	if (strncasecmp(resource_name, "res_", 4)) {
+		option_verbose = 0;
+		cfg = ast_load(AST_MODULE_CONFIG);
+		option_verbose = o;
+		if (cfg) {
+			if ((val = ast_variable_retrieve(cfg, "global", resource_name))
+					&& ast_true(val))
+				flags |= RTLD_GLOBAL;
+			ast_destroy(cfg);
+		}
+	} else {
+		/* Resource modules are always loaded global */
+		flags |= RTLD_GLOBAL;
 	}
 	
 	if (ast_pthread_mutex_lock(&modlock))
@@ -188,9 +193,9 @@ int ast_load_resource(char *resource_name)
 		ast_pthread_mutex_unlock(&modlock);
 		return -1;
 	}
-	strncpy(m->resource, resource_name, sizeof(m->resource));
+	strncpy(m->resource, resource_name, sizeof(m->resource)-1);
 	if (resource_name[0] == '/') {
-		strncpy(fn, resource_name, sizeof(fn));
+		strncpy(fn, resource_name, sizeof(fn)-1);
 	} else {
 		snprintf(fn, sizeof(fn), "%s/%s", AST_MODULE_DIR, resource_name);
 	}
@@ -315,49 +320,54 @@ int load_modules()
 		/* Load all modules */
 		DIR *mods;
 		struct dirent *d;
-		mods = opendir(AST_MODULE_DIR);
-		if (mods) {
-			while((d = readdir(mods))) {
-				/* Must end in .so to load it.  */
-				if ((strlen(d->d_name) > 3) && 
-				    !strcasecmp(d->d_name + strlen(d->d_name) - 3, ".so") &&
-					!ast_resource_exists(d->d_name)) {
-					/* It's a shared library -- Just be sure we're allowed to load it -- kinda
-					   an inefficient way to do it, but oh well. */
-					if (cfg) {
-						v = ast_variable_browse(cfg, "modules");
-						while(v) {
-							if (!strcasecmp(v->name, "noload") &&
-							    !strcasecmp(v->value, d->d_name)) 
-								break;
-							v = v->next;
-						}
-						if (v) {
-							if (option_verbose) {
-								ast_verbose( VERBOSE_PREFIX_1 "[skipping %s]\n", d->d_name);
-								fflush(stdout);
+		int x;
+		/* Make two passes.  First, load any resource modules, then load the others. */
+		for (x=0;x<2;x++) {
+			mods = opendir(AST_MODULE_DIR);
+			if (mods) {
+				while((d = readdir(mods))) {
+					/* Must end in .so to load it.  */
+					if ((strlen(d->d_name) > 3) && (x || !strncasecmp(d->d_name, "res_", 4)) && 
+					    !strcasecmp(d->d_name + strlen(d->d_name) - 3, ".so") &&
+						!ast_resource_exists(d->d_name)) {
+						/* It's a shared library -- Just be sure we're allowed to load it -- kinda
+						   an inefficient way to do it, but oh well. */
+						if (cfg) {
+							v = ast_variable_browse(cfg, "modules");
+							while(v) {
+								if (!strcasecmp(v->name, "noload") &&
+								    !strcasecmp(v->value, d->d_name)) 
+									break;
+								v = v->next;
+							}
+							if (v) {
+								if (option_verbose) {
+									ast_verbose( VERBOSE_PREFIX_1 "[skipping %s]\n", d->d_name);
+									fflush(stdout);
+								}
+								continue;
 							}
-							continue;
+							
+						}
+					    if (option_debug && !option_verbose)
+							ast_log(LOG_DEBUG, "Loading module %s\n", d->d_name);
+						if (option_verbose) {
+							ast_verbose( VERBOSE_PREFIX_1 "[%s]", d->d_name);
+							fflush(stdout);
+						}
+						if (ast_load_resource(d->d_name)) {
+							ast_log(LOG_WARNING, "Loading module %s failed!\n", d->d_name);
+							if (cfg)
+								ast_destroy(cfg);
+							return -1;
 						}
-						
-					}
-				    if (option_debug && !option_verbose)
-						ast_log(LOG_DEBUG, "Loading module %s\n", d->d_name);
-					if (option_verbose) {
-						ast_verbose( VERBOSE_PREFIX_1 "[%s]", d->d_name);
-						fflush(stdout);
-					}
-					if (ast_load_resource(d->d_name)) {
-						ast_log(LOG_WARNING, "Loading module %s failed!\n", d->d_name);
-						if (cfg)
-							ast_destroy(cfg);
-						return -1;
 					}
 				}
-			};
-		} else {
-			if (!option_quiet)
-				ast_log(LOG_WARNING, "Unable to open modules directory " AST_MODULE_DIR ".\n");
+				closedir(mods);
+			} else {
+				if (!option_quiet)
+					ast_log(LOG_WARNING, "Unable to open modules directory " AST_MODULE_DIR ".\n");
+			}
 		}
 	} 
 	ast_destroy(cfg);