working through nil and empty string queries