fixed bug with debug messages