diff --git a/taglib/ebml/matroska/ebmlmatroskaaudio.cpp b/taglib/ebml/matroska/ebmlmatroskaaudio.cpp
index 8f3cdd00..dee0a3d3 100644
--- a/taglib/ebml/matroska/ebmlmatroskaaudio.cpp
+++ b/taglib/ebml/matroska/ebmlmatroskaaudio.cpp
@@ -44,10 +44,11 @@ public:
     Element *value;
     
     if(info && (value = info->getChild(Constants::Duration))) {
-      length = static_cast<int>(value->getAsFloat());
-      if((value = info->getChild(Constants::TimecodeScale))){
-        length = static_cast<int>(length / (value->getAsUnsigned() * (1.0 / 1000000000)));
-      }
+      length = static_cast<int>(value->getAsFloat() / 1000000000.L);
+      if((value = info->getChild(Constants::TimecodeScale)))
+        length *= value->getAsUnsigned();
+      else
+		length *= 1000000;
     }
     
     info = elem->getChild(Constants::Tracks);
@@ -59,7 +60,7 @@ public:
     
     // Dirty bitrate:
     document->seek(0, File::End);
-    bitrate = static_cast<int>(8 * document->tell() / length / 1000);
+    bitrate = static_cast<int>(8 * document->tell() / ((length > 0) ? length : 1));
     
     if((value = info->getChild(Constants::Channels)))
       channels = static_cast<int>(value->getAsUnsigned());
diff --git a/taglib/ebml/matroska/ebmlmatroskafile.cpp b/taglib/ebml/matroska/ebmlmatroskafile.cpp
index 93ff80cc..5325ca3a 100644
--- a/taglib/ebml/matroska/ebmlmatroskafile.cpp
+++ b/taglib/ebml/matroska/ebmlmatroskafile.cpp
@@ -64,8 +64,8 @@ public:
     List<Element *> entries = elem->getChildren(Constants::Tag);
     for(List<Element *>::Iterator i = entries.begin(); i != entries.end(); ++i) {
       Element *target = (*i)->getChild(Constants::Targets);
-      ulli ttvalue = 0;
-      if(target && (target = (*i)->getChild(Constants::TargetTypeValue)))
+      ulli ttvalue = 50; // 50 is default (see spec.)
+      if(target && (target = target->getChild(Constants::TargetTypeValue)))
         ttvalue = target->getAsUnsigned();
       
       // Load all SimpleTags
@@ -198,7 +198,7 @@ bool EBML::Matroska::File::save()
     return false;
   
   // C++11 features would be nice: for(auto &i : d->tags) { /* ... */ }
-  // Well, here we just iterate over each extracted element.
+  // Well, here we just iterate each extracted element.
   for(List<std::pair<PropertyMap, std::pair<Element *, ulli> > >::Iterator i = d->tags.begin();
     i != d->tags.end(); ++i) {
     
@@ -218,7 +218,7 @@ bool EBML::Matroska::File::save()
           target->addElement(Constants::TargetType, Constants::TRACK);
         else if(i->second.second == Constants::MostCommonGroupingValue)
           target->addElement(Constants::TargetType, Constants::ALBUM);
-          
+        
         target->addElement(Constants::TargetTypeValue, i->second.second);
       }
       
diff --git a/tests/test_matroska.cpp b/tests/test_matroska.cpp
index 7e026334..a8fb6e9d 100644
--- a/tests/test_matroska.cpp
+++ b/tests/test_matroska.cpp
@@ -6,6 +6,7 @@
 #include "utils.h"
 
 #include <ebmlmatroskafile.h>
+#include <ebmlmatroskaaudio.h>
 
 using namespace std;
 using namespace TagLib;
@@ -15,6 +16,7 @@ class TestMatroska : public CppUnit::TestFixture
 	CPPUNIT_TEST_SUITE(TestMatroska);
 	CPPUNIT_TEST(testPredefined);
 	CPPUNIT_TEST(testInsertAndExtract);
+	CPPUNIT_TEST(testAudioProperties);
 	CPPUNIT_TEST_SUITE_END();
 	
 public:
@@ -94,6 +96,12 @@ public:
 		
 		AudioProperties* a = f.audioProperties();
 		CPPUNIT_ASSERT(a != 0);
+		
+		// Not a very nice assertion...
+		CPPUNIT_ASSERT_EQUAL(a->length(), 0);
+		// Bitrate is not nice and thus not tested.
+		CPPUNIT_ASSERT_EQUAL(a->sampleRate(), 44100);
+		CPPUNIT_ASSERT_EQUAL(a->channels(), 2);
 	}
 };