Added on_debug #2
Added on_debug #3

Moved on_debug to correct place.