Feature/fix for cv with rare classes