algorithms fix