added conditional case for termination in case of no device available under default API