Fix get_num_pending api call