fixed faulty ordering bug