It's easier to be an atheist when things go well than when things go wrong. It's natural for human beings to pray in time of need, when there's nothing left but hope that the universe will hear your plea. Belief is a coping mechanism and the concern about the existence of God doesn't factor. That's my opinion at least.