Merge client lsa fixes from HEAD (fix potential crashes).