fix sharing type errors in theory.ML