add expand state restore logic