If I was following one of the Maraje‘ , who was not the a‘lam amongst present ones, and I was not sure of this until the a‘lam Marje‘ passed away, what is the validity of my taqleed?

It is obligatory, as a precaution, to follow the a‘lam from now on, and the passed deeds are deemed valid.