Cardinals avoid winless homestand, beat Cubs 7-6