restore the old algorithm