Fix and optimize caption state change