Fix ordering by code