Fix sender rewrite and local account forward

Two fixes related to my previous PR #1.

See commit messages, sender rewriting got broken with 5cb524571407d7ae6148184eb3e74687a1e55f41.