nice routines for cross-validation, also doing it for non-null cases