add debug macros and test