fixed bug

fixed logic bug