repare md's function