fixed scan sort code