Fix LMS-1532 (partially instantiated XModules after an exception)