fix the logic error.