Fixed handling of empty iterables and improved implementation of QueryUtils.listToArgList.