Fixed bug in MD