Improve debugging output for legacy wrapper