Improve _debug function. Fix #234