Fix null object of query