more work on debug mode