Fix a logic error