Improve attribute selecotr match logic