Merge "Fix nondeterminism in LMS"