fixed error in two pass encoding