         picker.dismissViewControllerAnimated(true, completion: nil)
         
         //show image on confirmationView, save a copy
-        let takenImage = info[UIImagePickerControllerOriginalImage] as! UIImage
+        if let takenImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
         print("original image width: \(takenImage.size.width) height: \(takenImage.size.height)")
         if (takenImage.size.width > kResizeAllImagesToThisWidth) { //if image too big, shrink it down
             self.lastPhotoTaken = UIImage.resizeImage(takenImage, newWidth: kResizeAllImagesToThisWidth)

    }
    
    

    


        dateFormatter.dateFormat = "MM-dd-yyyy_HHmmss"
        let todaysDate = NSDate()
        self.lastPhotoTakenName = dateFormatter.stringFromDate(todaysDate) + ".JPG"
            
        }
        else { //if image isn't available (iCloud photo in Photo stream not loaded yet)
            self.destroyConfirmationView()
            picker.dismissViewControllerAnimated(true, completion: { _ in
                
                
                })
            self.showPhotoCouldntBeChosenAlert()
            print("picker canceled - photo not available!")
            
        }
    }
    
    
    func imagePickerControllerDidCancel(picker: UIImagePickerController)
    {
        self.destroyConfirmationView()
