fix back_to_dot and back search from the end state