A mortgage is not reaffirmed in bankruptcy unless the bankruptcy judge signs off on it with a reaffirmation. Even if you had signed a reaffirmation, unless the bankruptcy judge okayed it, it is not a valid reaffirmation. The careful bankruptcy judge would not be likely to allow you to reaffirm because the circumstance you describe is, in fact, all too common in bankruptcy.
Hope this perspective helps!
I recommend you consult with a bankruptcy attorney. Jason Anderson is a good one. (206) 706-2882.
[In accordance with the Avvo community guidelines, this communication does not constitute "legal advice", nor does it form an attorney-client relationship.]
You should have the modification agreement reviewed by an attorney. Was the modification a HAMP modification? If so, HAMP prohibits reaffirmation. And, modification of a first mortgage should not have any affect on the second mortgage. If you signed refinance documents, you would create new, post-bankrutpcy liability for yourself. But it does not sound like you did that so the bank is probably wrong and bullying you for payment. You may also want to look into whether you can strip off the second mortgage in a Chapter 13.