Added checking of expected number of frames