Fixing logic order