add GetAttr optimization on getting value attribute
add tests of opt