better debug flag setting