Hafidh Ibn Hajr hafidhuhallah said:

وقال القرطبي بعد أن رجح حمله على ظاهره: فإن قيل: كيف نرى الشرور والمعاصي واقعة في رمضان كثيراً، فلو صفدت الشياطين لم يقع ذلك: فالجواب: أنها إنما تُغَلُّ عن الصائمين الصوم الذي حوفظ على شروطه وروعيت آدابه، أو المصفد بعض الشياطين وهم المردة لا كلهم، كما تقدم في بعض الروايات، أو المقصود تقليل الشرور فيه، وهذا أمر محسوس، فإن وقوع ذلك فيه أقل من غيره، إذ لا يلزم من تصفيد جميعهم أن لا يقع شر ولا معصية، لأن لذلك أسباباً غير الشياطين كالنفوس الخبيثة والعادات القبيحة والشياطين الإنسية

“al-Qurtubi said after determining the correct opinion is that the Hadith should be taken upon its apparent meaning. If it is said: how can we see evil and disobedience occurring in Ramadan a lot if the devils are chained? If the devils are chained, then that should not occur. So the answer: verily they are only chained from those who fast a fasting that preserves its conditions and observes its manners. Or that some of the devils are chained and they are the strong ones not all of them as preceded in some versions of the Hadith. Or the intent is the lessening of evil in the month and this is an affair that is noticeable. So if that [evil] occurs, then it is less than [in] other [times]. It is not necessary for all of the devils to be chained for evil or disobedience not to occur because it has other means other than devils, like evil souls, bad habits, and devils from among the human”.

[Fathul-Bari]

So we learn that some of the evil we see in Ramadan can be attributed to bad habits and Ramadan is a time to break bad habits. After all, the Prophet sallahu alayhi wa salam said:

الْخَيْرُ عَادَةٌ

“Goodness is a (natural) habit”

[Reported by Ibn Majah and others. Graded Hasan by Al-Albani in Saheeh Ibn Majah no. 182]

That is another topic in itself [how Ramadan helps break bad habits]

Translated by

Faisal Ibn Abdul Qaadir Ibn Hassan
Abu Sulaymaan