fixed the ordering bug