The first one... Bob's mods already takes that scenario into account, you CAN'T have the same item as an ingredient twice, attempting to do so instead either does nothing, or increases the amount on the first entry, depending which function is used.
The second one... I would need your log file to investigate what's going on there. boblibrary writes things to the log file when it encounters unexpected results.
Also, that function, "replace_ingredient_in_all" is known for crashing the game when a broken ingredient table is added to the game data. For some reason, the game doesn't crash when in theory it should, and that's why my library trips over it and crashes the game. using the latest version of the library shouldn't be causing that issue though...