improve debugHandler