fix find_pieces_to_flip method