Add frame by frame sample and a bug fix.