fixed all algorithms