Fixed Riemann bug