bug fix: N needs to be stochastic