Fix testing issues in test_pm_deliver