>> I'll try to get the fix of this bug applied there too.
I attach a fix for restoring current buffer and selected window (the
latter hopefully taking care of selecting the right frame). Please tell
me whether it's sufficient for your purposes.
martin