diff --git a/csound-expression-typed.cabal b/csound-expression-typed.cabal
--- a/csound-expression-typed.cabal
+++ b/csound-expression-typed.cabal
@@ -1,5 +1,5 @@
 Name:          csound-expression-typed
-Version:       0.0.7.1
+Version:       0.0.7.2
 Cabal-Version: >= 1.6
 License:       BSD3
 License-file:  LICENSE
@@ -25,7 +25,7 @@
   Ghc-Options:    -Wall
   Build-Depends:
         base >= 4, base < 5, ghc-prim, containers, transformers >= 0.3, Boolean >= 0.1.0, colour >= 2.0, data-default, deepseq,
-        wl-pprint, stable-maps >= 0.0.3.3, csound-expression-dynamic >= 0.1.2
+        wl-pprint, stable-maps >= 0.0.3.3, csound-expression-dynamic >= 0.1.3
   Hs-Source-Dirs:      src/
   Exposed-Modules:
     Csound.Typed
diff --git a/src/Csound/Typed/GlobalState/Opcodes.hs b/src/Csound/Typed/GlobalState/Opcodes.hs
--- a/src/Csound/Typed/GlobalState/Opcodes.hs
+++ b/src/Csound/Typed/GlobalState/Opcodes.hs
@@ -160,7 +160,7 @@
 event_i = eventBy "event_i" Ir
 
 eventBy :: Monad m => String -> Rate -> Event -> DepT m ()
-eventBy name rate a = depT_ $ opcs name [(Xr, repeat rate)] 
+eventBy name rate a = depT_ $ opcs name [(Xr, Sr : repeat rate)] 
     (str "i" : (prim (PrimInstrId $ eventInstrId a)) : (eventStart a) : (eventDur a) : (eventArgs a))
 
 appendChn :: E -> Event -> Event
diff --git a/src/Csound/Typed/Types/Prim.hs b/src/Csound/Typed/Types/Prim.hs
--- a/src/Csound/Typed/Types/Prim.hs
+++ b/src/Csound/Typed/Types/Prim.hs
@@ -36,8 +36,8 @@
 import Data.Default
 import Data.Boolean
 
-import Csound.Dynamic hiding (double, int, str, when1, whens, ifBegin, ifEnd, elseBegin, elseIfBegin, untilBegin, untilEnd, untilDo)
-import qualified Csound.Dynamic as D(double, int, str, ifBegin, ifEnd, elseBegin, elseIfBegin, untilBegin, untilEnd)
+import Csound.Dynamic hiding (double, int, str, when1, whens, ifBegin, ifEnd, elseBegin, untilBegin, untilEnd, untilDo)
+import qualified Csound.Dynamic as D(double, int, str, ifBegin, ifEnd, elseBegin, untilBegin, untilEnd)
 import Csound.Typed.GlobalState
 
 -- | Signals
@@ -183,12 +183,12 @@
 
           getGen16 xs = case xs of
             _:durN:_:rest    -> durN : getGen16 rest
-            _                -> xs
+            _                -> []
 
           substGen16 durs xs = case (durs, xs) of 
             ([], as) -> as
             (_, [])  -> []
-            (d:ds, valN:_:typeN:rest)   -> valN : d : (typeN * d) : substGen16 ds rest
+            (d:ds, valN:_:typeN:rest)   -> valN : d : typeN : substGen16 ds rest
             (_, _)   -> xs
 
 -- | Skips normalization (sets table size to negative value)
@@ -395,8 +395,8 @@
         elseIfs as
         elseBegin 
         el
-        ifEnd
-    where elseIfs = mapM_ (\(p, body) -> elseIfBegin p >> body)
+        foldl1 (>>) $ replicate (1 + length bodies) ifEnd
+    where elseIfs = mapM_ (\(p, body) -> elseBegin >> ifBegin p >> body)
 
 ifBegin :: BoolSig -> SE ()
 ifBegin a = fromDep_ $ D.ifBegin =<< lift (toGE a)
@@ -407,8 +407,8 @@
 elseBegin :: SE ()
 elseBegin = fromDep_ D.elseBegin
 
-elseIfBegin :: BoolSig -> SE ()
-elseIfBegin a = fromDep_ $ D.elseIfBegin =<< lift (toGE a)
+-- elseIfBegin :: BoolSig -> SE ()
+-- elseIfBegin a = fromDep_ $ D.elseIfBegin =<< lift (toGE a)
 
 untilDo :: BoolSig -> SE () -> SE ()
 untilDo p body = do
