fixed using DEBUG_N from multiple threads