Fixed a buggy behaviour in the sparql rewriting