diff --git a/filebrowser.module b/filebrowser.module
index ada3310..a7466ee 100644
--- a/filebrowser.module
+++ b/filebrowser.module
@@ -28,6 +28,7 @@ use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Render\Element;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\node\Entity\Node;
 use Drupal\node\NodeInterface;
 use Drupal\Component\Utility\Unicode;
@@ -303,7 +304,7 @@ function filebrowser_node_mass_update_thumbnails($nodes) {
  * @inheritdoc
  */
 function filebrowser_theme_suggestions_container_alter(array &$suggestions, array $variables) {
-  if ($node = \Drupal::routeMatch()->getParameter('node')) {
+  if ($node = _filebrowser_get_node_from_path()) {
     if ($node->bundle() == 'dir_listing') {
       if(!empty($variables['element']['#attributes']['class'])) {
         $classes = $variables['element']['#attributes']['class'];
@@ -324,7 +325,7 @@ function filebrowser_theme_suggestions_container_alter(array &$suggestions, arra
  */
 // Not used, left here for example
 function filebrowser_theme_suggestions_form_element_alter(array &$suggestions, array $variables) {
-  if ($node = \Drupal::routeMatch()->getParameter('node')) {
+  if ($node = _filebrowser_get_node_from_path()) {
     if ($node->bundle() == 'dir_listing') {
       if(!empty($variables['element']['#attributes']['class'])) {
         $classes = $variables['element']['#attributes']['class'];
@@ -366,4 +367,21 @@ function template_preprocess_filebrowser_container_column(&$variables) {
   $variables['attributes'] = $element['#attributes'];
   // filebrowser:
   $variables['width'] = $variables['element']['#attributes']['width'];
-}
\ No newline at end of file
+}
+
+/**
+ * Returns node object from path (if any), or NULL.
+ *
+ * @param RouteMatchInterface $routeMatch
+ */
+function _filebrowser_get_node_from_path($route_match = NULL) {
+  $route_match = $route_match ?: \Drupal::routeMatch();
+  if ($node = $route_match->getParameter('node')) {
+    if (!is_object($node)) {
+      // The parameter is node ID.
+      $node = Node::load($node);
+    }
+    return $node;
+  }
+  return NULL;
+}
diff --git a/src/Breadcrumb/BreadcrumbBuilder.php b/src/Breadcrumb/BreadcrumbBuilder.php
index aafffb5..433e275 100644
--- a/src/Breadcrumb/BreadcrumbBuilder.php
+++ b/src/Breadcrumb/BreadcrumbBuilder.php
@@ -35,7 +35,7 @@ class BreadcrumbBuilder implements BreadcrumbBuilderInterface {
    */
   public function applies(RouteMatchInterface $route_match) {
 
-    $this->node = $route_match->getParameter('node');
+    $this->node = _filebrowser_get_node_from_path($route_match);
     return isset($this->node) && $this->node->bundle() == 'dir_listing';
   }
 
@@ -45,7 +45,7 @@ class BreadcrumbBuilder implements BreadcrumbBuilderInterface {
   public function build(RouteMatchInterface $route_match) {
     /** @var \Drupal\node\NodeInterface $node */
     $breadcrumb = new Breadcrumb();
-    $this->node = $route_match->getParameter('node');
+    $this->node = _filebrowser_get_node_from_path($route_match);
     $title = $this->node->getTitle();
     $fid = \Drupal::request()->query->get('fid');
     if (isset($fid)) {
