diff --git a/src/FileInfo.php b/src/FileInfo.php
index 612f924..4433bf7 100644
--- a/src/FileInfo.php
+++ b/src/FileInfo.php
@@ -74,10 +74,11 @@ public static function fromPath($path, $as = '')
     }
 
     /**
-     * @return int
+     * @return int the filesize. always 0 for directories
      */
     public function getSize()
     {
+        if($this->isdir) return 0;
         return $this->size;
     }
 
@@ -340,4 +341,4 @@ public function match($include = '', $exclude = '')
 
 class FileInfoException extends \Exception
 {
-}
\ No newline at end of file
+}
diff --git a/src/Tar.php b/src/Tar.php
index e29c7d5..b720589 100644
--- a/src/Tar.php
+++ b/src/Tar.php
@@ -573,12 +573,19 @@ protected function parseHeader($block)
         // Handle Long-Link entries from GNU Tar
         if ($return['typeflag'] == 'L') {
             // following data block(s) is the filename
-            $filename = trim($this->readbytes(ceil($header['size'] / 512) * 512));
+            $filename = trim($this->readbytes(ceil($return['size'] / 512) * 512));
             // next block is the real header
             $block  = $this->readbytes(512);
             $return = $this->parseHeader($block);
+
             // overwrite the filename
             $return['filename'] = $filename;
+        }elseif ($return['typeflag'] == 'x') {
+            // following data block(s) is the filename
+            $filename = trim($this->readbytes(ceil($return['size'] / 512) * 512));
+            // next block is the real header
+            $block  = $this->readbytes(512);
+            $return = $this->parseHeader($block);
         }
 
         return $return;
diff --git a/tests/tar.test.php b/tests/tar.test.php
index 989cb6a..483e774 100644
--- a/tests/tar.test.php
+++ b/tests/tar.test.php
@@ -186,7 +186,38 @@ public function test_dogfood()
             unlink($archive);
         }
     }
+	
+	/**
+     * Extract the prebuilt tar files with PAX headers
+     */
+    public function test_tarpaxextract()
+    {
+        $dir = dirname(__FILE__).'/tar';
+        $out = sys_get_temp_dir().'/dwtartest'.md5(time());
+
+        foreach ($this->extensions as $ext) {
+            $tar  = new Tar();
+            $file = "$dir/pax_test.$ext";
 
+            $tar->open($file);
+            $list = $tar->extract($out);
+            
+            clearstatcache();
+
+            $this->assertFileExists($out.'/4слайд-1.jpg', "Extracted $file");
+            $this->assertEquals(15251, filesize($out.'/4слайд-1.jpg'), "Extracted $file");
+
+            $this->assertFileExists($out.'/4слайд-2.jpg', "Extracted $file");
+            $this->assertEquals(16671, filesize($out.'/4слайд-2.jpg'), "Extracted $file");
+            
+            $this->assertFileExists($out.'/4слайд.jpg', "Extracted $file");
+            $this->assertEquals(214949, filesize($out.'/4слайд.jpg'), "Extracted $file");
+			
+			
+            self::rdelete($out);
+        }
+    }
+	
     /**
      * Extract the prebuilt tar files
      */
diff --git a/tests/tar/pax_test.tar b/tests/tar/pax_test.tar
new file mode 100644
index 0000000..be4a685
Binary files /dev/null and b/tests/tar/pax_test.tar differ
diff --git a/tests/tar/pax_test.tar.bz2 b/tests/tar/pax_test.tar.bz2
new file mode 100644
index 0000000..6a5d992
Binary files /dev/null and b/tests/tar/pax_test.tar.bz2 differ
diff --git a/tests/tar/pax_test.tar.gz b/tests/tar/pax_test.tar.gz
new file mode 100644
index 0000000..f5df8fb
Binary files /dev/null and b/tests/tar/pax_test.tar.gz differ
diff --git a/tests/tar/pax_test.tbz b/tests/tar/pax_test.tbz
new file mode 100644
index 0000000..f9a0f09
Binary files /dev/null and b/tests/tar/pax_test.tbz differ
diff --git a/tests/tar/pax_test.tgz b/tests/tar/pax_test.tgz
new file mode 100644
index 0000000..394a3d1
Binary files /dev/null and b/tests/tar/pax_test.tgz differ