Safe mode bug fix