diff --git a/imp/imp_main.cpp b/imp/imp_main.cpp
index 7ba90aa..e9d4766 100644
--- a/imp/imp_main.cpp
+++ b/imp/imp_main.cpp
@@ -92,7 +92,14 @@ int main(int argc, char *argv[]) {
 		std::locale::global(std::locale(std::cout.getloc(), new comma));
 	}
 	#else
-	std::locale::global(std::locale(""));
+	try {
+	    // Try setting the "native locale", in order to retain
+	    // things like decimal separator.  This might fail in
+	    // case the user has no notion of a native locale.
+	    std::locale::global(std::locale(""));
+	} catch(...) {
+	    // just proceed
+	}
 	#endif
 
 
diff --git a/util/util.cpp b/util/util.cpp
index 5597332..91e745e 100644
--- a/util/util.cpp
+++ b/util/util.cpp
@@ -42,6 +42,7 @@ namespace horizon {
 	}
 
 	#else
+	# if defined(__linux__)
 	std::string get_exe_dir() {
 
 		char buf[PATH_MAX];
@@ -55,6 +56,23 @@ namespace horizon {
 			return "";
         }
 	}
+	# elif defined(__FreeBSD__)
+	std::string get_exe_dir() {
+
+		char buf[PATH_MAX];
+		ssize_t len;
+        if((len = readlink("/proc/curproc/file", buf, sizeof(buf)-1)) != -1) {
+        	buf[len] = '\0';
+        	return Glib::path_get_dirname(buf);
+        }
+        else {
+        	throw std::runtime_error("can't find executable");
+			return "";
+        }
+	}
+	# else
+	#  error Dont know how to find path to executable on your OS.
+	# endif
 	#endif
 
 	std::string coord_to_string(const Coordf &pos, bool delta) {
