Fix boolean logic