Add debug code for unit tests