fix the console script
take query string into account
take query string into account