debug logic