Use proper debug functions

Authored by staniek.