fix boolean logic