changed reportRedirect function to handle a blank query without breaking