Fix test_deliver
refactor