LUDiagnoseOS: change locking and error handling