Added error video handling and fixed a silly bug on stats file