Fixed some bugs with attribute handling.