diff --git a/modl/recsys.py b/modl/recsys.py
index 22e8ac0..ed4f6e8 100644
--- a/modl/recsys.py
+++ b/modl/recsys.py
@@ -114,7 +114,7 @@ def fit(self, X, y=None):
         self.feature_freq_ = np.bincount(X.indices) / n_samples
         self.feature_n_iter_ = np.zeros(n_features, dtype=int)
 
-        sparsity = X.nnz / n_samples / n_features
+        sparsity = float(X.nnz) / n_samples / n_features
         if self.batch_size is None:
             batch_size = int(ceil(1. / sparsity))
         else:
diff --git a/modl/utils/randomkit/random_fast.pyx b/modl/utils/randomkit/random_fast.pyx
index 00e2bae..e017cb7 100644
--- a/modl/utils/randomkit/random_fast.pyx
+++ b/modl/utils/randomkit/random_fast.pyx
@@ -68,6 +68,8 @@ cdef class RandomState:
         elif isinstance(seed, np.integer):
             iseed = int(seed)
             rk_seed(iseed, self.internal_state)
+        elif isinstance(seed, (int, long)):
+            rk_seed(seed, self.internal_state)
         else:
             raise ValueError("Wrong seed")