fixed replacing of bnodes with vars in queries