move finalize to receiver.py