Clear junk code and fix SPARQL bug