add switch to enable debug mode