fixed some logical

fixed some logical