fix ordering bug