[BUGFIX] Multiple fixes for Locking API and TSFE locking