WyRL: added some addition saftey checking code to catch an invalid term being constructed for #380