         self.picker = picker
         
         if UIImagePickerController.isSourceTypeAvailable(.camera) {
-            HUD.show(.progress)
-
-            picker.allowsEditing = false
-            picker.sourceType = UIImagePickerControllerSourceType.camera
-            picker.cameraDevice = .front
-
-            picker.cameraCaptureMode = .photo
-            picker.modalPresentationStyle = .fullScreen
-            picker.delegate = self
-            present(picker,animated: true,completion: nil)
+            DispatchQueue.main.async {
+                HUD.show(.progress)
+            }
+
+            DispatchQueue.main.async {
+                picker.allowsEditing = false
+                picker.sourceType = UIImagePickerControllerSourceType.camera
+                picker.cameraDevice = .front
+                
+                picker.cameraCaptureMode = .photo
+                picker.modalPresentationStyle = .fullScreen
+                picker.delegate = self
+                self.present(picker,animated: true, completion: {
+                    HUD.hide()
+                })
+            }
+
         } else {
             let popup = PopupDialog(title: "Camera Not Found", message: nil, buttonAlignment: .horizontal, transitionStyle: .zoomIn, gestureDismissal: true) {
             }
             
             let buttonOne = CancelButton(title: "OK") {
+                self.dismiss(animated: true, completion: nil)
             }
             
             popup.addButtons([buttonOne])

    }

    func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
        HUD.hide()

        picker.dismiss(animated: true, completion: {
            self.dismiss(animated: true, completion: nil)

{
    
    func imageCropViewControllerDidCancelCrop(controller: HHImageCropViewController) {
        controller.dismiss(animated: true, completion: {
            self.dismiss(animated: true, completion: nil)
        })
    }
    
    func imageCropViewController(controller: HHImageCropViewController, didCropImage croppedImage: UIImage?, usingCropRect cropRect: CGRect) {
