update to fixed logic error