ksort attributes correctly