add debug flag to test code