         case 0:
             return 1
         case 1:
-            return min(recentPhotos.count, ImagePickerViewController.maxPhotoCount)
+            return min(recentPhotos.count, maxPhotoCount)
         default:
             fatalError("Don't know about section \(section)")
         }

        collectionView.registerClass(PhotoCell.self, forCellWithReuseIdentifier: PhotoCell.reuseIdentifier)
        collectionView.registerClass(CameraCell.self, forCellWithReuseIdentifier: CameraCell.reuseIdentifier)
        
        let opts = PHFetchOptions()
        opts.sortDescriptors = [
            NSSortDescriptor(key: "creationDate", ascending: false)
        ]
        if let photos = PHAsset.fetchAssetsWithMediaType(.Image, options: opts) {
            let max = min(ImagePickerViewController.maxPhotoCount, photos.count)
            let indexes = NSIndexSet(indexesInRange: NSMakeRange(0, max))
            recentPhotos = photos.objectsAtIndexes(indexes).map { $0 as! PHAsset }
        }
        pickerContainer.addSubview(collectionView)
        initCamera()
    }

        } else if indexPath.section == 1 {
            var cell = collectionView.dequeueReusableCellWithReuseIdentifier(PhotoCell.reuseIdentifier, forIndexPath: indexPath) as! PhotoCell
            if cell.tag != 0 {
                cachingImageManager.cancelImageRequest(PHImageRequestID(cell.tag))
            }
            cell.tag = Int(cachingImageManager.requestImageForAsset(recentPhotos[indexPath.row], targetSize: ImagePickerViewController.targetSize, contentMode: .AspectFit, options: nil) { (result, _) in
                cell.image = result
            })
            return cell
