made some debug output conditional