proper debug handling