diff --git a/lightmotif/src/pli/mod.rs b/lightmotif/src/pli/mod.rs
index f124ce6d436f30fa751ed49d9af1ff0a35d3145f..d7b0872c0eb24271c9c88c3cacf2f1d1895c3dcb 100644
--- a/lightmotif/src/pli/mod.rs
+++ b/lightmotif/src/pli/mod.rs
@@ -142,7 +142,7 @@ pub trait Stripe<A: Alphabet, C: StrictlyPositive> {
         let s = seq.as_ref();
         let length = s.len();
         let rows = (length / C::USIZE) + ((length % C::USIZE > 0) as usize);
-        let mut striped = StripedSequence::new(DenseMatrix::new(rows), length);
+        let mut striped = StripedSequence::new(DenseMatrix::new(rows), length).unwrap();
         self.stripe_into(s, &mut striped);
         striped
     }
@@ -159,7 +159,7 @@ pub trait Stripe<A: Alphabet, C: StrictlyPositive> {
         for (i, &x) in s.iter().enumerate() {
             data[i % rows][i / rows] = x;
         }
-        for i in s.len()..matrix.rows() * matrix.columns() {
+        for i in s.len()..data.rows() * data.columns() {
             data[i % rows][i / rows] = A::default_symbol();
         }
     }
diff --git a/lightmotif/src/seq.rs b/lightmotif/src/seq.rs
index 3e48a8854297c8e08adb7d14b7df39f50df2625c..12abfc219293eb91a45b1bca5e509ea03a443583 100644
--- a/lightmotif/src/seq.rs
+++ b/lightmotif/src/seq.rs
@@ -11,6 +11,7 @@ use typenum::marker_traits::Unsigned;
 use super::abc::Alphabet;
 use super::abc::Symbol;
 use super::dense::DenseMatrix;
+use super::err::InvalidData;
 use super::err::InvalidSymbol;
 use super::num::StrictlyPositive;
 use super::pwm::ScoringMatrix;
@@ -145,12 +146,16 @@ pub struct StripedSequence<A: Alphabet, C: StrictlyPositive> {
 
 impl<A: Alphabet, C: StrictlyPositive> StripedSequence<A, C> {
     /// Create a new striped sequence from the given dense matrix.
-    pub fn new(data: DenseMatrix<A::Symbol, C>, length: usize) -> Self {
-        Self {
-            data,
-            length,
-            wrap: 0,
-            alphabet: std::marker::PhantomData,
+    pub fn new(data: DenseMatrix<A::Symbol, C>, length: usize) -> Result<Self, InvalidData> {
+        if data.rows() * data.columns() < length {
+            Err(InvalidData)
+        } else {
+            Ok(Self {
+                data,
+                length,
+                wrap: 0,
+                alphabet: std::marker::PhantomData,
+            })
         }
     }