fix riccati calcuration