try to fix mtd problems according to Kong's code