Changes to allow running under safe mode