fix branch not deleted bug and add branch delete test