fix/improve scope matching