Empty check added to query.