diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 128d2430116b851a06f143e3951daab2c6caa0fb..b6d2326ebedc61e8324b46226aabeefae75dce69 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -23,6 +23,7 @@ repos:
     - id: detect-private-key
     - id: end-of-file-fixer
 -   repo: https://github.com/asottile/blacken-docs
-    rev: v1.10.0
+    rev: v1.12.1
     hooks:
     - id: blacken-docs
+      additional_dependencies: [black==22.3.0]
diff --git a/tfields/triangles_3d.py b/tfields/triangles_3d.py
index 1b7e7f64a6b93b8b5958a405350c37bd909c6e4b..5776d1fbccb64edafbea5ffbc145a291491171b6 100644
--- a/tfields/triangles_3d.py
+++ b/tfields/triangles_3d.py
@@ -8,9 +8,9 @@ part of tfields library
 """
 import warnings
 import typing
+import logging
 import numpy as np
 import tfields
-import logging
 from tfields.lib.decorators import cached_property
 
 
@@ -112,10 +112,9 @@ class Triangles3D(tfields.TensorFields):
                         ]
                     else:
                         item = tfields.Tensors(item)
-        except IndexError:
+        except IndexError as err:
             logging.warning(
-                "Index error occured for field.__getitem__. Error "
-                "message: {err}".format(**locals())
+                "Index error occured for field.__getitem__. Error message: %s", err
             )
         return item
 
@@ -330,9 +329,9 @@ class Triangles3D(tfields.TensorFields):
         )  # side length of side opposite to pointA
         b = np.linalg.norm(pointC - pointA, axis=1)
         c = np.linalg.norm(pointB - pointA, axis=1)
-        bary1 = a ** 2 * (b ** 2 + c ** 2 - a ** 2)
-        bary2 = b ** 2 * (a ** 2 + c ** 2 - b ** 2)
-        bary3 = c ** 2 * (a ** 2 + b ** 2 - c ** 2)
+        bary1 = a**2 * (b**2 + c**2 - a**2)
+        bary2 = b**2 * (a**2 + c**2 - b**2)
+        bary3 = c**2 * (a**2 + b**2 - c**2)
         matrices = np.concatenate((pointA, pointB, pointC), axis=1).reshape(
             pointA.shape + (3,)
         )