Non-hero units picking up tomes crashes the game

There are many benefits to giving normal units hero inventory. It allows them to pick up stuff like gold coins, use items, etc. etc.

The one drawback seems to be that if they pick up a tome or any item that gives permanent str/int/agi bonuses or exp, the game crashes for everyone. Maybe there could be a check to see if the unit is a hero before allowing them to pick up a tome?