fix MD bugs