fix getIds, use select correctly