fixed mgsub bug