Make debug mode works in all cases