diff --git a/notebooks/Pysim/Block.py b/notebooks/Pysim/Block.py
index 8e69b208fe9fdd96057a9b22cf33ebee6a5eb860..848490cd6c9d7a6a467b433ff5af9122d5b036ce 100644
--- a/notebooks/Pysim/Block.py
+++ b/notebooks/Pysim/Block.py
@@ -114,7 +114,7 @@ class SquareSignal(Block):
             
                     
     def Step(self,t,dt):
-            d = t/self.Ts-floor(t/self.Ts);
+            d = t/self.Ts-int(t/self.Ts);
             if d > self.duty:
                   self.y[0] = self.lo;
             else:
@@ -451,7 +451,13 @@ class StateSpace(Block):
                 else:
                     print("WARNING: Can not handle self.C with dimension "+str(self.C.ndim))
             for j in range(0,self.ninput):
-                self.y[i] = self.y[i] +self.D[j]*self.u[j]
+                if self.C.ndim == 1:
+                    self.y[i] = self.y[i] + self.D[j]*self.u[j]
+                elif self.C.ndim == 2:
+                    #prevent [ValueError: setting an array element with a sequence.] for 2 dimensional self.C:
+                    self.y[i] = self.y[i] + self.D[i][j]*self.u[j]
+                else:
+                    print("WARNING: Can not handle self.D with dimension "+str(self.C.ndim))
         self.updatestate(t,dt)                
         
     def Reset(self):
@@ -531,4 +537,4 @@ class TransferFunction(Block):
                 dxdt[i] = dxdt[i] + self.A[i,j]*x[j]
         return dxdt
         
-
+