handle empty lists in folds/minimum & folds/maximum

fixes #357