diff --git a/gps/core/ContextBase.cpp b/gps/core/ContextBase.cpp
index 47194cba67034b0099a81a75d32b584a385a5582..35e65854b7e8d816c0800635e47e750efa16c45d 100644
--- a/gps/core/ContextBase.cpp
+++ b/gps/core/ContextBase.cpp
@@ -92,79 +92,65 @@ const loc_param_s_type ContextBase::mSap_conf_table[] =
 
 void ContextBase::readConfig()
 {
-    static bool confReadDone = false;
-    if (!confReadDone) {
-        confReadDone = true;
-        /*Defaults for gps.conf*/
-        mGps_conf.INTERMEDIATE_POS = 0;
-        mGps_conf.ACCURACY_THRES = 0;
-        mGps_conf.NMEA_PROVIDER = 0;
-        mGps_conf.GPS_LOCK = 0;
-        mGps_conf.SUPL_VER = 0x10000;
-        mGps_conf.SUPL_MODE = 0x1;
-        mGps_conf.SUPL_ES = 0;
-        mGps_conf.SUPL_HOST[0] = 0;
-        mGps_conf.SUPL_PORT = 0;
-        mGps_conf.CAPABILITIES = 0x7;
-        /* LTE Positioning Profile configuration is disable by default*/
-        mGps_conf.LPP_PROFILE = 0;
-        /*By default no positioning protocol is selected on A-GLONASS system*/
-        mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
-        /*XTRA version check is disabled by default*/
-        mGps_conf.XTRA_VERSION_CHECK=0;
-        /*Use emergency PDN by default*/
-        mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
-        /* By default no LPPe CP technology is enabled*/
-        mGps_conf.LPPE_CP_TECHNOLOGY = 0;
-        /* By default no LPPe UP technology is enabled*/
-        mGps_conf.LPPE_UP_TECHNOLOGY = 0;
-
-        /*Defaults for sap.conf*/
-        mSap_conf.GYRO_BIAS_RANDOM_WALK = 0;
-        mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
-        mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
-        mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
-        mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
-        mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
-        mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
-        mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
-        mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
-        mSap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
-        mSap_conf.SENSOR_USAGE = 0; /* Enabled */
-        mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/
-        /* Values MUST be set by OEMs in configuration for sensor-assisted
-          navigation to work. There are NO default values */
-        mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
-        mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
-        mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
-        mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
-        mSap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
-        mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
-        mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
-        mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
-        mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
-        /* default provider is SSC */
-        mSap_conf.SENSOR_PROVIDER = 1;
-
-        /* None of the 10 slots for agps certificates are writable by default */
-        mGps_conf.AGPS_CERT_WRITABLE_MASK = 0;
-
-        /* inject supl config to modem with config values from config.xml or gps.conf, default 1 */
-        mGps_conf.AGPS_CONFIG_INJECT = 1;
-
-        UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
-        UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
-
-        switch (getTargetGnssType(loc_get_target())) {
-          case GNSS_GSS:
-          case GNSS_AUTO:
-             // For APQ targets, MSA/MSB capabilities should be reset
-             mGps_conf.CAPABILITIES &= ~(LOC_GPS_CAPABILITY_MSA | LOC_GPS_CAPABILITY_MSB);
-             break;
-          default:
-             break;
-        }
-    }
+   /*Defaults for gps.conf*/
+   mGps_conf.INTERMEDIATE_POS = 0;
+   mGps_conf.ACCURACY_THRES = 0;
+   mGps_conf.NMEA_PROVIDER = 0;
+   mGps_conf.GPS_LOCK = 0;
+   mGps_conf.SUPL_VER = 0x10000;
+   mGps_conf.SUPL_MODE = 0x1;
+   mGps_conf.SUPL_ES = 0;
+   mGps_conf.SUPL_HOST[0] = 0;
+   mGps_conf.SUPL_PORT = 0;
+   mGps_conf.CAPABILITIES = 0x7;
+   /* LTE Positioning Profile configuration is disable by default*/
+   mGps_conf.LPP_PROFILE = 0;
+   /*By default no positioning protocol is selected on A-GLONASS system*/
+   mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
+   /*XTRA version check is disabled by default*/
+   mGps_conf.XTRA_VERSION_CHECK=0;
+   /*Use emergency PDN by default*/
+   mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
+   /* By default no LPPe CP technology is enabled*/
+   mGps_conf.LPPE_CP_TECHNOLOGY = 0;
+   /* By default no LPPe UP technology is enabled*/
+   mGps_conf.LPPE_UP_TECHNOLOGY = 0;
+
+   /*Defaults for sap.conf*/
+   mSap_conf.GYRO_BIAS_RANDOM_WALK = 0;
+   mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
+   mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
+   mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
+   mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
+   mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
+   mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
+   mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
+   mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
+   mSap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
+   mSap_conf.SENSOR_USAGE = 0; /* Enabled */
+   mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/
+   /* Values MUST be set by OEMs in configuration for sensor-assisted
+      navigation to work. There are NO default values */
+   mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+   mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+   mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+   mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+   mSap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
+   mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+   mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+   mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+   mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+   /* default provider is SSC */
+   mSap_conf.SENSOR_PROVIDER = 1;
+
+   /* None of the 10 slots for agps certificates are writable by default */
+   mGps_conf.AGPS_CERT_WRITABLE_MASK = 0;
+
+   /* inject supl config to modem with config values from config.xml or gps.conf, default 1 */
+   mGps_conf.AGPS_CONFIG_INJECT = 1;
+
+   UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
+   UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
 }
 
 uint32_t ContextBase::getCarrierCapabilities() {
diff --git a/gps/gnss/GnssAdapter.cpp b/gps/gnss/GnssAdapter.cpp
index 6df8e128e0e56e66dbe22dd60ee969ba96f3ea85..3ce64e90320a70a246bb7fc27c6286dbbdd14fd7 100644
--- a/gps/gnss/GnssAdapter.cpp
+++ b/gps/gnss/GnssAdapter.cpp
@@ -1967,6 +1967,7 @@ GnssAdapter::enableCommand(LocationTechnologyType techType)
             } else if (powerVoteId > 0) {
                 err = LOCATION_ERROR_ALREADY_STARTED;
             } else {
+                mContext.modemPowerVote(true);
                 mAdapter.setPowerVoteId(mSessionId);
                 mApi.setGpsLock(GNSS_CONFIG_GPS_LOCK_NONE);
                 mAdapter.mXtraObserver.updateLockStatus(
@@ -1978,7 +1979,6 @@ GnssAdapter::enableCommand(LocationTechnologyType techType)
 
     if (mContext != NULL) {
         sendMsg(new MsgEnableGnss(*this, *mLocApi, *mContext, sessionId, techType));
-        mContext->modemPowerVote(true);
     } else {
         LOC_LOGE("%s]: Context is NULL", __func__);
     }
@@ -2011,6 +2011,7 @@ GnssAdapter::disableCommand(uint32_t id)
             if (powerVoteId != mSessionId) {
                 err = LOCATION_ERROR_ID_UNKNOWN;
             } else {
+                mContext.modemPowerVote(false);
                 mAdapter.setPowerVoteId(0);
                 mApi.setGpsLock(mAdapter.convertGpsLock(ContextBase::mGps_conf.GPS_LOCK));
                 mAdapter.mXtraObserver.updateLockStatus(
@@ -2022,7 +2023,6 @@ GnssAdapter::disableCommand(uint32_t id)
 
     if (mContext != NULL) {
         sendMsg(new MsgDisableGnss(*this, *mLocApi, *mContext, id));
-        mContext->modemPowerVote(false);
     }
 
 }
diff --git a/gps/utils/LocIpc.cpp b/gps/utils/LocIpc.cpp
index 9f344a1b0642dca4dde4ed84320a6c777c184d2b..675664a5f087ab7020e57254277d24faf38b5a70 100644
--- a/gps/utils/LocIpc.cpp
+++ b/gps/utils/LocIpc.cpp
@@ -69,9 +69,8 @@ bool LocIpc::startListeningNonBlocking(const std::string& name) {
 }
 
 bool LocIpc::startListeningBlocking(const std::string& name) {
-    bool stopRequested = false;
-    int fd = socket(AF_UNIX, SOCK_DGRAM, 0);
 
+    int fd = socket(AF_UNIX, SOCK_DGRAM, 0);
     if (fd < 0) {
         LOC_LOGe("create socket error. reason:%s", strerror(errno));
         return false;
@@ -88,75 +87,89 @@ bool LocIpc::startListeningBlocking(const std::string& name) {
 
     if (::bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
         LOC_LOGe("bind socket error. reason:%s", strerror(errno));
-    } else {
-        mIpcFd = fd;
+        ::close(fd);
+        fd = -1;
+        return false;
+    }
 
-        // inform that the socket is ready to receive message
-        onListenerReady();
+    mIpcFd = fd;
+
+    // inform that the socket is ready to receive message
+    onListenerReady();
+
+    ssize_t nBytes = 0;
+    std::string msg = "";
+    std::string abort = LOC_MSG_ABORT;
+    while (1) {
+        msg.resize(LOC_MSG_BUF_LEN);
+        nBytes = ::recvfrom(mIpcFd, (void*)(msg.data()), msg.size(), 0, NULL, NULL);
+        if (nBytes < 0) {
+            break;
+        } else if (nBytes == 0) {
+            continue;
+        }
 
-        ssize_t nBytes = 0;
-        std::string msg = "";
-        std::string abort = LOC_MSG_ABORT;
-        while (1) {
-            msg.resize(LOC_MSG_BUF_LEN);
-            nBytes = ::recvfrom(fd, (void*)(msg.data()), msg.size(), 0, NULL, NULL);
-            if (nBytes < 0) {
-                LOC_LOGe("cannot read socket. reason:%s", strerror(errno));
-                break;
-            } else if (0 == nBytes) {
-                continue;
-            }
+        if (strncmp(msg.data(), abort.c_str(), abort.length()) == 0) {
+            LOC_LOGi("recvd abort msg.data %s", msg.data());
+            break;
+        }
 
-            if (strncmp(msg.data(), abort.c_str(), abort.length()) == 0) {
-                LOC_LOGi("recvd abort msg.data %s", msg.data());
-                stopRequested = true;
-                break;
+        if (strncmp(msg.data(), LOC_MSG_HEAD, sizeof(LOC_MSG_HEAD) - 1)) {
+            // short message
+            msg.resize(nBytes);
+            onReceive(msg);
+        } else {
+            // long message
+            size_t msgLen = 0;
+            sscanf(msg.data(), LOC_MSG_HEAD"%zu", &msgLen);
+            msg.resize(msgLen);
+            size_t msgLenReceived = 0;
+            while ((msgLenReceived < msgLen) && (nBytes > 0)) {
+                nBytes = recvfrom(mIpcFd, (void*)&(msg[msgLenReceived]),
+                        msg.size() - msgLenReceived, 0, NULL, NULL);
+                msgLenReceived += nBytes;
             }
-
-            if (strncmp(msg.data(), LOC_MSG_HEAD, sizeof(LOC_MSG_HEAD) - 1)) {
-                // short message
-                msg.resize(nBytes);
+            if (nBytes > 0) {
                 onReceive(msg);
             } else {
-                // long message
-                size_t msgLen = 0;
-                sscanf(msg.data(), LOC_MSG_HEAD"%zu", &msgLen);
-                msg.resize(msgLen);
-                size_t msgLenReceived = 0;
-                while ((msgLenReceived < msgLen) && (nBytes > 0)) {
-                    nBytes = recvfrom(fd, (void*)&(msg[msgLenReceived]),
-                                      msg.size() - msgLenReceived, 0, NULL, NULL);
-                    msgLenReceived += nBytes;
-                }
-                if (nBytes > 0) {
-                    onReceive(msg);
-                } else {
-                    LOC_LOGe("cannot read socket. reason:%s", strerror(errno));
-                    break;
-                }
+                break;
             }
         }
     }
 
-    if (::close(fd)) {
-        LOC_LOGe("cannot close socket:%s", strerror(errno));
+    if (mStopRequested) {
+        mStopRequested = false;
+        return true;
+    } else {
+        LOC_LOGe("cannot read socket. reason:%s", strerror(errno));
+        (void)::close(mIpcFd);
+        mIpcFd = -1;
+        return false;
     }
-    unlink(name.c_str());
-
-    return stopRequested;
 }
 
 void LocIpc::stopListening() {
+
     const char *socketName = nullptr;
+    mStopRequested = true;
 
-    if (mIpcFd >= 0) {
+    if (mRunnable) {
         std::string abort = LOC_MSG_ABORT;
         socketName = (reinterpret_cast<LocIpcRunnable *>(mRunnable))->mIpcName.c_str();
         send(socketName, abort);
+        mRunnable = nullptr;
+    }
+
+    if (mIpcFd >= 0) {
+        if (::close(mIpcFd)) {
+            LOC_LOGe("cannot close socket:%s", strerror(errno));
+        }
         mIpcFd = -1;
     }
-    if (mRunnable) {
-        mRunnable = nullptr;
+
+    //delete from the file system at the end
+    if (socketName) {
+        unlink(socketName);
     }
 }
 
diff --git a/gps/utils/LocIpc.h b/gps/utils/LocIpc.h
index 810efb032e497d40ea0478f621d7d8d7c534c0d6..364093bdef1940a0a66608df95661b203fc06e50 100644
--- a/gps/utils/LocIpc.h
+++ b/gps/utils/LocIpc.h
@@ -44,7 +44,7 @@ class LocIpcSender;
 class LocIpc {
 friend LocIpcSender;
 public:
-    inline LocIpc() : mIpcFd(-1), mRunnable(nullptr) {}
+    inline LocIpc() : mIpcFd(-1), mStopRequested(false), mRunnable(nullptr) {}
     inline virtual ~LocIpc() { stopListening(); }
 
     // Listen for new messages in current thread. Calling this funciton will
@@ -93,6 +93,7 @@ private:
             const uint8_t data[], uint32_t length);
 
     int mIpcFd;
+    bool mStopRequested;
     LocThread mThread;
     LocRunnable *mRunnable;
 };
diff --git a/gps/utils/loc_target.cpp b/gps/utils/loc_target.cpp
index f6fd728aac2753e0a5bb97f45c9dacfb5657aba0..569f3a722d566d7fad442983c48971ae54be92c0 100644
--- a/gps/utils/loc_target.cpp
+++ b/gps/utils/loc_target.cpp
@@ -54,7 +54,6 @@
 #define STR_MTP         "MTP"
 #define STR_APQ         "apq"
 #define STR_SDC         "sdc"  // alternative string for APQ targets
-#define STR_QCS         "qcs"  // string for Gen9 APQ targets
 #define STR_MSM         "msm"
 #define STR_SDM         "sdm"  // alternative string for MSM targets
 #define STR_APQ_NO_WGR  "baseband_apq_nowgr"
@@ -176,8 +175,7 @@ unsigned int loc_get_target(void)
     }
 
     if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ||
-        !memcmp(baseband, STR_SDC, LENGTH(STR_SDC)) ||
-        !memcmp(baseband, STR_QCS, LENGTH(STR_QCS)) ) {
+        !memcmp(baseband, STR_SDC, LENGTH(STR_SDC)) ) {
 
         if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
             && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )