Fix various debug system problems