fixed a bug in submenu replacement