change the method to get app pid