Adding a double check for query string before using it