Fixed a silly logic error