Removed a logic error