fix gillespi algorithm