Fixed issue with branches extending wrong after they end