Fix logic from PR #2