When configuring issue custom fields for a single tracker, the custom fields are order by creation date. Instead they should be ordered by their position.

Attached you may find a patch, implementing the desired behavior. Furthermore, it's changing the line IssueCustomField.all.sort to IssueCustomField.sorted in the TrackersController. The latter will sort the records within the DB, which should be slightly faster.