added hw debug code