diff --git a/libcelt/modes.c b/libcelt/modes.c
index 2b2e68664e871c993ee49595dfe525db5fd87bfa..ca509921e82ee5882882ceb2b233991a1e50d12f 100644
--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -323,12 +323,13 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error)
    } else if ((celt_int32)frame_size*300 >= Fs && (frame_size%4)==0)
    {
      LM = 1;
-   } else if ((celt_int32)frame_size*300 <= Fs)
+   } else
    {
      LM = 0;
    }
+
    /* Shorts longer than 3.3ms are not supported. */
-   else
+   if ((celt_int32)(frame_size>>LM)*300 > Fs)
    {
       if (error)
          *error = CELT_INVALID_MODE;