Prevent WSOD when a term is deleted

Issue #4313