Fix updating torch state