sort attributes by it's sort order and name fix