     }
     
     private func _setupMaxZoomScale() {
+        var maxZoom = CGFloat(1.0)
+        beginZoomScale = CGFloat(1.0)
+        
         if cameraDevice == .Back {
-            if let maxZoom = backCameraDevice?.activeFormat.videoMaxZoomFactor {
-                beginZoomScale = CGFloat(1.0)
-                maxZoomScale = maxZoom
-            }
-        }
-        else {
-            if let maxZoom = frontCameraDevice?.activeFormat.videoMaxZoomFactor {
-                beginZoomScale = CGFloat(1.0)
-                maxZoomScale = maxZoom
-            }
-        }
+            maxZoom = (backCameraDevice?.activeFormat.videoMaxZoomFactor)!
+        }
+        else if cameraDevice == .Front {
+            maxZoom = (frontCameraDevice?.activeFormat.videoMaxZoomFactor)!
+        }
+
+        maxZoomScale = maxZoom
     }
 
     private func _checkIfCameraIsAvailable() -> CameraState {

        do {
            let captureDevice = AVCaptureDevice.devices().first as? AVCaptureDevice
            try captureDevice?.lockForConfiguration()
            
            zoomScale = max(1.0, min(beginZoomScale * scale, maxZoomScale))
            captureDevice?.videoZoomFactor = zoomScale
            
            captureDevice?.unlockForConfiguration()
        } catch {
            print("Error locking configuration")
        }

            if cameraIsSetup {
                if cameraDevice != oldValue {
                    _updateCameraDevice(cameraDevice)
                    _setupMaxZoomScale()
                    _zoom(0)
                }
            }
        }
