move replace_pi