Only add the query string if it's not empty and it's not equal to '?'