debug mode improved