diff --git a/application/controllers/Webservices.php b/application/controllers/Webservices.php
index ab46f72..1d037a8 100644
--- a/application/controllers/Webservices.php
+++ b/application/controllers/Webservices.php
@@ -337,15 +337,25 @@ class Webservices extends CI_Controller {
       $request = json_decode($postdata, true);
       $auth = apache_request_headers()['Auth'];
       $request['auth'] = $auth;
-      $result = $this->Webservice_model->call_ambulance($request);
-
-      if ($result) {
-        print json_encode(array('status'=>'success','data'=>$result));
+      if(!empty($request) && isset($request['trip_type']) && !empty($request['trip_type']) && 
+         isset($request['source_name']) && !empty($request['source_name']) && 
+         isset($request['destination_name']) && !empty($request['destination_name']) && 
+         isset($request['source_latitude']) && !empty($request['source_latitude']) && 
+         isset($request['source_longitude']) && !empty($request['source_longitude']) && 
+         isset($request['destination_latitude']) && !empty($request['destination_latitude']) && 
+         isset($request['destination_longitude']) && !empty($request['destination_longitude'])){
+
+        $result = $this->Webservice_model->call_ambulance($request);
+        if ($result) {
+          print json_encode(array('status'=>'success','data'=>$result));
+        } else {
+          print json_encode(array('status'=>'error','message'=>'Something Went wrong','error'=>'507'));
+        }
       } else {
-        print json_encode(array('status'=>'error','message'=>'Something Went wrong','error'=>'507'));
+        print json_encode(array('status'=>'error','message'=>'Required fields are empty','error'=>'508'));
       }
     } else {
-      print json_encode(array('status'=>'error','message'=>'Something Went wrong','error'=>'507'));
+      print json_encode(array('status'=>'error','message'=>'Authentication Error','error'=>'509'));
     }
   }
 
@@ -444,7 +454,7 @@ class Webservices extends CI_Controller {
 
   public function request_status() { 
     header('Content-type: application/json'); 
-    $request = $_GET; 
+    $request = $_GET;
     if (isset($request['request_id'])) {   
       $result = $this->Webservice_model->req_status($request);
 
@@ -456,7 +466,7 @@ class Webservices extends CI_Controller {
         print json_encode(array('status'=>'error','message'=>'Something Went wrong','error'=>'606'));
       }
     } else {
-      print json_encode(array('status'=>'error','message'=>'Something Went wrong','error'=>'606')); 
+      print json_encode(array('status'=>'error','message'=>'Something Went wrong','error'=>'607')); 
     }
   }
 
@@ -482,25 +492,18 @@ class Webservices extends CI_Controller {
 
   public function phone_number_availability(){
     header('Content-type: application/json'); 
-    if (isset(apache_request_headers()['Auth'])) {   
-      $auth = apache_request_headers()['Auth'];
-
-      $postdata = file_get_contents("php://input");
-      $request = json_decode($postdata, true);
-      $request['auth'] = $auth;
+    $postdata = file_get_contents("php://input");
+    $request = json_decode($postdata, true);
 
-      if (!empty($request)) {
-        $phStatus = $this->Webservice_model->phone_number_availability($request);
-        if($phStatus){
-          print json_encode(array('status'=>'success','data'=>array('is_available'=>true)));
-        } else {
-          print json_encode(array('status'=>'success','data'=>array('is_available'=>false)));
-        }
+    if (!empty($request) && isset($request['phone']) && !empty($request['phone'])) {
+      $phStatus = $this->Webservice_model->phone_number_availability($request);
+      if($phStatus){
+        print json_encode(array('status'=>'success','data'=>array('is_available'=>true)));
       } else {
-        print json_encode(array('status'=>'error','code'=>'210','message'=>'Required Fields are empty.'));
+        print json_encode(array('status'=>'success','data'=>array('is_available'=>false)));
       }
-    } else { 
-      print json_encode(array('status'=>'error','code'=>'209','message'=>'Something Went wrong'));
+    } else {
+      print json_encode(array('status'=>'error','code'=>'210','message'=>'Required Fields are empty.'));
     }
   }
 
diff --git a/application/models/Webservice_model.php b/application/models/Webservice_model.php
index d84ae35..fd7feab 100644
--- a/application/models/Webservice_model.php
+++ b/application/models/Webservice_model.php
@@ -687,7 +687,7 @@
 
                   } else {
 
-                        return $result;
+                        return 0;
 
                   }
 
diff --git a/application/models/Webservices_driver_model.php b/application/models/Webservices_driver_model.php
index f675d0f..a7e7119 100644
--- a/application/models/Webservices_driver_model.php
+++ b/application/models/Webservices_driver_model.php
@@ -477,19 +477,33 @@ class Webservices_driver_model extends CI_Model {
                   $query = $this->db->query($data1);
 
                   $res = $query->row();
-                   
-                  $driver_status = $res->status;
 
-                  if ($driver_status == 4 || $driver_status == 5) {
-
-                        $data = "SELECT transport_details.total_time AS time, transport_details.trip_distance AS distance, drivers.profile_image AS driver_photo, drivers.phone AS driver_phone_number, transport_details.status AS request_status, transport_details.transport_id AS trip_id, transport_details.pickup_lat AS source_latitude, transport_details.pickup_lng AS source_longitude, transport_details.drop_lat AS destination_latitude, transport_details.drop_lng AS destination_longitude FROM transport_details LEFT JOIN drivers ON transport_details.driver_id = drivers.driver_id LEFT JOIN customers ON customers.customer_id = transport_details.customer_id WHERE transport_details.driver_id = '$driv_id' AND transport_details.status IN(4,5) ORDER BY transport_details.transport_id DESC LIMIT 0,1";
-
-
-                        $result = $this->db->query($data)->row();
-                        
-                        return $result;
+                  if(!empty($res)){
+                        $driver_status = $res->status;
+                        if ($driver_status == 4 || $driver_status == 5) {
+                              $data = "SELECT transport_details.total_time AS time, 
+                                              transport_details.trip_distance AS distance, 
+                                              drivers.profile_image AS driver_photo, 
+                                              drivers.phone AS driver_phone_number, 
+                                              transport_details.status AS request_status, 
+                                              transport_details.transport_id AS trip_id, 
+                                              transport_details.pickup_lat AS source_latitude,
+                                              transport_details.pickup_lng AS source_longitude, 
+                                              transport_details.drop_lat AS destination_latitude, 
+                                              transport_details.drop_lng AS destination_longitude 
+                                        FROM transport_details 
+                                        LEFT JOIN drivers ON transport_details.driver_id = drivers.driver_id 
+                                        LEFT JOIN customers ON customers.customer_id = transport_details.customer_id 
+                                        WHERE transport_details.driver_id = '$driv_id' AND 
+                                              transport_details.status IN(4,5) 
+                                        ORDER BY transport_details.transport_id DESC LIMIT 0,1";
+                              $result = $this->db->query($data)->row();
+                              return $result;
+                        } else {
+                              return 0;
+                        }
                   } else {
-                        return $result;
+                        return 0;
                   }
 
             } else {
@@ -561,19 +575,19 @@ class Webservices_driver_model extends CI_Model {
 
                   $currency = $rs->currency;
 
-                  $query = "SELECT t.transport_id AS id,
-                  customers.customer_id AS customer_id,
-                  CONCAT(customers.first_name,' ',customers.last_name) AS customer_name, 
-                  customers.profile_image AS customer_photo, 
-                  t.pickup_location AS source_location,
-                  t.pickup_lng AS source_longitude, 
-                  t.pickup_lat AS source_latitude,
-                  t.drop_location AS destination_location,
-                  t.drop_lat AS destination_latitude, 
-                  t.drop_lng AS destination_longitude, 
-                  CONCAT(t.trip_cost,'','$currency') AS fare FROM transport_details AS t LEFT JOIN drivers AS d ON d.driver_id = t.driver_id LEFT JOIN customers ON t.customer_id = customers.customer_id WHERE t.driver_id = '$driv_id' AND request_type = 1 ";    
+                  $query = "SELECT t.transport_id AS id,customers.customer_id AS customer_id,
+                                   CONCAT(customers.first_name,' ',customers.last_name) AS customer_name, 
+                                   customers.profile_image AS customer_photo, 
+                                   t.pickup_location AS source_location,t.pickup_lat AS source_latitude,
+                                   t.drop_location AS destination_location,
+                                   t.pickup_lng AS source_longitude,CONCAT(t.trip_cost,'','$currency') AS fare,
+                                   t.drop_lat AS destination_latitude,t.drop_lng AS destination_longitude
+                            FROM transport_details AS t 
+                            LEFT JOIN drivers AS d ON d.driver_id = t.driver_id 
+                            LEFT JOIN customers ON t.customer_id = customers.customer_id 
+                            WHERE t.driver_id = '$driv_id' AND request_type = 1 ";    
 
-                   return $query;  
+                  return $query;  
 
             } else {
 
@@ -687,7 +701,7 @@ function booster_seat($request) {
 
                   $data=array('status_booster_seat'=>$request['is_booster_seat']);
                   $this->db->where('id', $driver_id);
-                  $this->db->update('driver',$data);
+                  $this->db->update('drivers',$data);
                   return true;
 
             } else {
@@ -700,9 +714,9 @@ function booster_seat($request) {
 
       public function driver_reg($data) {
 
-            $num = $this->db->where('phone', $data['phone'])->get('driver')->num_rows();
+            $num = $this->db->where('phone', $data['phone'])->get('drivers')->num_rows();
 
-            $num1 = $this->db->where('email', $data['email'])->get('driver')->num_rows();
+            $num1 = $this->db->where('email', $data['email'])->get('drivers')->num_rows();
 
             if ($num > 0) {
                   $result = array('status' => 'error', 'message' => 'Mobile number Already Exists');
@@ -713,7 +727,7 @@ function booster_seat($request) {
             else {
                   $unique_id = $this->generate_unique();
                   $otp = rand(1111, 9999);
-                  $this->db->insert('driver', array('phone' => $data['phone'], 'email' => $data['email'], 'password' => md5($data['password']),'driver_name' => $data['name'], 'city' => $data['city']));
+                  $this->db->insert('drivers', array('phone' => $data['phone'], 'email' => $data['email'], 'password' => md5($data['password']),'driver_name' => $data['name'], 'city' => $data['city']));
                   $user_id = $this->db->insert_id();
 
                   $this->db->insert('car', array('driv_id' => $user_id));
@@ -750,7 +764,7 @@ function booster_seat($request) {
 
                   $rs = $query->row();
 
-                  $query = $this->db->where('id', $rs->driver_id)->get('driver')->row();
+                  $query = $this->db->where('id', $rs->driver_id)->get('drivers')->row();
 
                   $res = $query->status_booster_seat;
 
@@ -783,7 +797,7 @@ function booster_seat($request) {
 
                   $data = array('fcm_token' => $request['fcm_token']);
 
-                  $this->db->where('id', $rs->driver_id)->update('driver', $data);
+                  $this->db->where('id', $rs->driver_id)->update('drivers', $data);
 
                   return true;
 
@@ -799,7 +813,7 @@ function booster_seat($request) {
 
             $phone = $request['phone'];
 
-            $num = $this->db->where('phone', $phone)->get('driver')->num_rows();
+            $num = $this->db->where('phone', $phone)->get('drivers')->num_rows();
 
             if ($num > 0) {
 
@@ -826,7 +840,7 @@ function booster_seat($request) {
 
       //           $data = array('driver_name'=>$request['name'],'email'=>$request['email'],'phone'=>$request['phone'],'address'=>$request['address'],'city'=>$request['city'],'state'=>$request['state'],'post_code'=>$request['postal_code'],'image'=>$request['image']);
 
-      //           $this->db->where('id',$rs->driver_id)->update('driver',$data);
+      //           $this->db->where('id',$rs->driver_id)->update('drivers',$data);
 
       //           //echo $this->db->last_query();
 
@@ -924,7 +938,7 @@ function booster_seat($request) {
 
                   $rs = $query->row();
 
-                  $this->db->where('id', $rs->driver_id)->update('driver', $data);
+                  $this->db->where('id', $rs->driver_id)->update('drivers', $data);
 
                   $res = $this->db->query("SELECT * FROM `driver` WHERE id = '$rs->driver_id'")->row();
 
@@ -1109,7 +1123,7 @@ function booster_seat($request) {
 
                   $driv_id = $rs->driver_id;
 
-                  $result = $this->db->where('id', $driv_id)->update('driver', array('driver_type' => $request['driver_type']));
+                  $result = $this->db->where('id', $driv_id)->update('drivers', array('driver_type' => $request['driver_type']));
 
                   return true;
 
@@ -1135,7 +1149,7 @@ function booster_seat($request) {
 
                   $data = array('image' => $request['image']);
 
-                  $this->db->where('id', $rs->driver_id)->update('driver', $data);
+                  $this->db->where('id', $rs->driver_id)->update('drivers', $data);
 
                   return true;
 
@@ -1295,7 +1309,7 @@ function booster_seat($request) {
 
                   $data = array('is_deaf' => filter_var($request['is_deaf'], FILTER_VALIDATE_BOOLEAN), 'is_flash_required' => filter_var($request['is_flash_required_for_requests'], FILTER_VALIDATE_BOOLEAN));
 
-                  $this->db->where('id', $rs->driver_id)->update('driver', $data);
+                  $this->db->where('id', $rs->driver_id)->update('drivers', $data);
 
                   return true;
 
@@ -1317,7 +1331,7 @@ function booster_seat($request) {
 
                   $driv_id = $rs->driver_id;
 
-                  $data1 = "SELECT * FROM driver WHERE id = '$driv_id' ";
+                  $data1 = "SELECT * FROM drivers WHERE id = '$driv_id' ";
 
                   $query1 = $this->db->query($data1);
 
@@ -1785,7 +1799,7 @@ function booster_seat($request) {
 
                   customer.name AS customer_name,customer.image AS customer_photo FROM
 
-                  booking LEFT JOIN driver ON driver.id = booking.driver_id LEFT JOIN customer ON booking.user_id = customer.id
+                  booking LEFT JOIN drivers ON driver.id = booking.driver_id LEFT JOIN customer ON booking.user_id = customer.id
 
                   LEFT JOIN pattern ON booking.pattern_id = pattern.id WHERE booking.id = '$id'";
 
@@ -2073,7 +2087,7 @@ function booster_seat($request) {
 
                         customer.image AS customer_photo FROM booking
 
-                        LEFT JOIN driver ON driver.id = booking.driver_id LEFT JOIN customer ON booking.user_id = customer.id
+                        LEFT JOIN drivers ON driver.id = booking.driver_id LEFT JOIN customer ON booking.user_id = customer.id
 
                         LEFT JOIN pattern ON booking.pattern_id = pattern.id WHERE booking.driver_id = '$driv_id' AND booking.book_date BETWEEN $start_time AND $end_time AND booking.status != 0";