fixed boolean logic issue