Fix loop crash when no results