finishd the find_local_id function