1) When a building is sold (as opposed to being foreclosed upon) all leases remain in force; the new owner becomes ("steps into the shoes of") the former owner; and the tenant and new owner are bound by all the terms of the contract. Both parties have to comply with the terms of the contract, including notice provisions.2) You cannot hold breaches of the contract (including of implied covenants to it; see below) by the former owner against the new owner, however--it may be that you would have had grounds to terminate the lease or sue for damages, such as for violations of the "implied warranty of habitability" (the legal obligation that rental premises be "fit for their intended purpose") against the former owner, but if you did not, you cannot immediately take action for those breaches against the new owner. Instead, the new owner must be provided notice of any problems and a reasonable chance to "cure," or correct, them first.