fix debug handling