Fixing logic error.