diff --git a/darkplaces-text.cabal b/darkplaces-text.cabal
--- a/darkplaces-text.cabal
+++ b/darkplaces-text.cabal
@@ -1,5 +1,5 @@
 name:                darkplaces-text
-version:             0.2
+version:             0.2.1
 license:             GPL-2
 license-file:        LICENSE
 author:              Slava Bacherikov
@@ -54,7 +54,7 @@
                        QuickCheck >= 2.5,
                        hspec
 
-  default-extensions:  OverloadedStrings
+  default-extensions:  OverloadedStrings, FlexibleInstances
 
 source-repository head
   type:                git
diff --git a/src/DarkPlaces/Text/Types.hs b/src/DarkPlaces/Text/Types.hs
--- a/src/DarkPlaces/Text/Types.hs
+++ b/src/DarkPlaces/Text/Types.hs
@@ -7,6 +7,7 @@
 import System.Console.ANSI
 import System.IO (Handle, hPutChar)
 import Data.Monoid
+import Text.Printf
 import Data.String
 import Numeric
 
@@ -126,7 +127,7 @@
     repr DPNewline = fromString "\n"
     repr (DPString s) = s
     repr (SimpleColor c) = fromString $ "^" ++ show c
-    repr (HexColor c) = fromString $ "^x" ++ showHex c ""
+    repr (HexColor c) = fromString $ printf "^x%03X" c
 
 
 optimizeDPText :: (Monoid a) => DPText a -> DPText a
diff --git a/tests/DarkPlaces/TextSpec.hs b/tests/DarkPlaces/TextSpec.hs
--- a/tests/DarkPlaces/TextSpec.hs
+++ b/tests/DarkPlaces/TextSpec.hs
@@ -16,18 +16,26 @@
     arbitrary = BL.pack <$> arbitrary
 
 
-instance (Arbitrary a) => Arbitrary (DPTextToken a) where
+instance Arbitrary (DPTextToken BL.ByteString) where
     arbitrary = do
         t <- choose (0, 3) :: Gen Int
         case t of
             0 -> SimpleColor <$> choose (0, 9)
             1 -> HexColor <$> choose (0, 0xFFF)
-            2 -> DPString <$> arbitrary
+            2 -> DPString <$> arWithNoTockens
             3 -> return DPNewline
 
 
-instance (Arbitrary a) => Arbitrary (DPText a) where
+instance Arbitrary (DPText BL.ByteString) where
     arbitrary = DPText <$> arbitrary
+
+
+arWithNoTockens :: Gen BL.ByteString
+arWithNoTockens = do
+    res <- arbitrary
+    case parseDPText res of
+        DPText [DPString s] -> return s
+        _                   -> arWithNoTockens
 
 
 spec :: Spec
