Fix a logic bug.