calculate contour levels in a way that avoids empty collections (should fix #2)