debug mode fixes