bug 848238 - fix attachTo existing+BFCache combo

plus a test for it