fix menu item selection and remove previous documents