Fixed bug in number of frames being output