fixed logic mistake