fix totalFrame counter