Only delete branch functon when it exists