Protect against empty lists of zones, calendars or programs

This time I tried with no zone, no calendar and no programs (no zone might be going a bit far, but that was very parallel to the programs code anyway).

Fixed a few "config.zone.length" used where it should have been "config.programs.length".