fix reordering bug