Minor big fixes in the algorithms