daemon: cleanup: replace loop with if