Fix issue #1978
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index 7223a29..e90c92d 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -47,9 +47,10 @@
 	 * representation of it. Sub-folders contained with the
 	 * directory will be mapped as well.
 	 *
-	 * @param	string	path to source
-	 * @param	int	depth of directories to traverse (0 = fully recursive, 1 = current dir, etc)
-	 * @param	bool	whether to show hidden files
+	 * @param	string	$source_dir		Path to source
+	 * @param	int	$directory_depth	Depth of directories to traverse
+	 *						(0 = fully recursive, 1 = current dir, etc)
+	 * @param	bool	$hidden			Whether to show hidden files
 	 * @return	array
 	 */
 	function directory_map($source_dir, $directory_depth = 0, $hidden = FALSE)
@@ -70,7 +71,8 @@
 
 				if (($directory_depth < 1 OR $new_depth > 0) && @is_dir($source_dir.$file))
 				{
-					$filedata[$file] = directory_map($source_dir.$file.DIRECTORY_SEPARATOR, $new_depth, $hidden);
+					$file .= DIRECTORY_SEPARATOR;
+					$filedata[$file] = directory_map($source_dir.$file, $new_depth, $hidden);
 				}
 				else
 				{
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index eda18bf..f4cb90c 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -86,6 +86,7 @@
 	 - ``read_file()`` is now a deprecated alias of ``file_get_contents()``.
    -  :doc:`Security Helper <helpers/security_helper>` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library <libraries/security>`.
    -  Deprecated :doc:`String Helper <helpers/string_helper>` function ``repeater()`` - it's just an alias for PHP's native ``str_repeat()``.
+   -  :doc:`Directory Helper <helpers/directory_helper>` ``directory_map()`` will now append DIRECTORY_SEPARATOR to directory names in the returned array.
 
 -  Database
 
@@ -427,6 +428,7 @@
 -  Fixed a bug - :doc:`Routing Library <general/routing>` didn't properly handle *default_controller* in a subdirectory when a method is also specified.
 -  Fixed a bug (#953) - :doc:`post_controller_constructor hook <general/hooks>` wasn't called with a *404_override*.
 -  Fixed a bug (#1220) - :doc:`Profiler Library <general/profiling>` didn't display information for database objects that are instantiated inside models.
+-  Fixed a bug (#1978) - :doc:`Directory Helper <helpers/directory_helper>` function ``directory_map()``'s return array didn't make a distinction between directories and file indexes when a directory with a numeric name is present.
 
 Version 2.1.3
 =============
diff --git a/user_guide_src/source/helpers/directory_helper.rst b/user_guide_src/source/helpers/directory_helper.rst
index cf88732..a785ebc 100644
--- a/user_guide_src/source/helpers/directory_helper.rst
+++ b/user_guide_src/source/helpers/directory_helper.rst
@@ -57,7 +57,7 @@
 			(        
 				[0] => benchmark.html        
 				[1] => config.html        
-				[database] => Array
+				["database/"] => Array
 					(              
 						[0] => query_builder.html              
 						[1] => binds.html              
@@ -76,5 +76,4 @@
 				[7] => loader.html        
 				[8] => pagination.html        
 				[9] => uri.html
-			)
-
+			)
\ No newline at end of file