Fixed order of attributes mattering

Fixes issues #1 and #3 with attribute ordering.