Fixes boolean operations order