fix: codes put on wrong conditional branch