Fixed debug() function