Fixing inverted boolean logic