work for frame by frame mode