debug mode improvements