fixed logic error.