As of Version 2.3, type mismatch is reported poorly--
when types does not match, term gets replaced by null.
Null value causes NullPointerException somewhere in
the implementation with no original reason indication. I
would suggest to throw an exception at the point where
mismatch is identified.