update some logic and demo.

delay getting type of attribute til it being transformed.
update the demo codes.