fix a logic error