diff --git a/src/tools.h b/src/tools.h
index 435e3cfbb1e02595d6147346456d7e70f8148a8e..db68ba46f4f5691f00276e92a49489a5891f0b09 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -57,7 +57,7 @@ namespace filesystem {
 inline bool create_directories(std::string &path) {
   char tmp[PATH_MAX];
 
-  // Add terminating '/' and make a writable copy;
+  // Add terminating '/' and make a writtable copy;
   int len = snprintf(tmp, sizeof(tmp), "%s/", path.c_str());
   if (len > PATH_MAX) len = PATH_MAX;
 
@@ -65,7 +65,7 @@ inline bool create_directories(std::string &path) {
   for (char *p = tmp; *p; p++) {
     if (*p == '/') {
       // Found a new directory, ignore any subsequent back slashes
-      long int dir_len = p - last_backslash - 1;
+      int dir_len = p - last_backslash - 1;
       if (dir_len > 0) {
         *p = 0;
         if (mkdir(tmp, S_IRWXU | S_IRWXG | S_IRWXO) < 0 && (errno != EEXIST)) {