debug: fix logic