fixed logic issue in line 44