Defect energetics in MgO treated by first-principles methods