We need to understand what it means for God to discipline His children.
After Israel came back from captivity, they still found reason to give God thanks. No matter how bad it may seem, there is always reason to give God thanks.