migrate debug: refactor