mask extraction initial commti
trying to support redo, buggy
fixed redo problem