Carolina ended a five-game losing streak