Set attribute instead of property.

Fix #3130.