changed codes for removing bag in CMAKE