Fixed a logic error.