AG-3822: better check for empty collection