QueryBuilder refactoring. Update some query to getLastQuery()