»Und dabei hatte ich gehofft« could be (laboriously) replaced by
Und hinsichtlich des eben Erwähnten hatte ich doch gehofft ...
(And concerning what has been said before I really had hoped ...)
or better by
Wo ich doch gehofft hatte ...
(Although I had hoped ...)