fix reordering behavior of keep