Fixes to LCM code