Fixes for Boolean terms in arrays (including fix for bug 517).