CLEREZZA-865: Fix serialization of bnodes for internal queries