Fixed debug functions to work correctly in high memory.