make stash restore work properly