check if query string is null before string concatenation