fix algorithms