More refactoring

This commit is the end of the Request -> Query
refactoring, fixing the segmentation fault
due to a wrong variable naming.