properly check for (non-)empty vectors