apply the rest of Peter's patch!