Better page mode detection in macro