Fix bug with attribute setting