Ore duplication bug fix

Fixes #4951